perspectapi-ts-sdk 3.0.1 → 3.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/dist/index.d.mts +152 -2
- package/dist/index.d.ts +152 -2
- package/dist/index.js +246 -0
- package/dist/index.mjs +245 -0
- package/package.json +1 -1
- package/src/client/bundles-client.ts +263 -0
- package/src/client/site-users-client.ts +93 -0
- package/src/index.ts +8 -0
- package/src/perspect-api-client.ts +3 -0
- package/src/types/index.ts +88 -1
package/dist/index.d.mts
CHANGED
|
@@ -472,6 +472,7 @@ interface CreateCheckoutSessionRequest {
|
|
|
472
472
|
price?: string;
|
|
473
473
|
quantity: number;
|
|
474
474
|
sku_id?: number;
|
|
475
|
+
product_id?: number;
|
|
475
476
|
price_data?: {
|
|
476
477
|
currency: string;
|
|
477
478
|
product_data: {
|
|
@@ -489,6 +490,8 @@ interface CreateCheckoutSessionRequest {
|
|
|
489
490
|
customer_email?: string;
|
|
490
491
|
customerEmail?: string;
|
|
491
492
|
site_user_id?: string;
|
|
493
|
+
referral_code?: string;
|
|
494
|
+
referrer_site_user_id?: string;
|
|
492
495
|
currency?: string;
|
|
493
496
|
metadata?: CheckoutMetadata;
|
|
494
497
|
mode?: 'payment' | 'subscription' | 'setup';
|
|
@@ -609,7 +612,21 @@ interface SiteUserOrder {
|
|
|
609
612
|
payment_status?: string;
|
|
610
613
|
line_items: any[];
|
|
611
614
|
created_at: string;
|
|
612
|
-
|
|
615
|
+
completed_at?: string;
|
|
616
|
+
}
|
|
617
|
+
interface CreditTransaction {
|
|
618
|
+
id: number;
|
|
619
|
+
amount_cents: number;
|
|
620
|
+
balance_after_cents: number;
|
|
621
|
+
type: string;
|
|
622
|
+
description: string | null;
|
|
623
|
+
created_at: string;
|
|
624
|
+
}
|
|
625
|
+
interface CreditBalance {
|
|
626
|
+
balance_cents: number;
|
|
627
|
+
}
|
|
628
|
+
interface CreditBalanceWithTransactions extends CreditBalance {
|
|
629
|
+
transactions: CreditTransaction[];
|
|
613
630
|
}
|
|
614
631
|
interface RequestOtpRequest {
|
|
615
632
|
email: string;
|
|
@@ -640,6 +657,62 @@ interface UpdateSiteUserRequest {
|
|
|
640
657
|
interface SetProfileValueRequest {
|
|
641
658
|
value: string;
|
|
642
659
|
}
|
|
660
|
+
interface ProductBundleGroup {
|
|
661
|
+
bundle_group_id: number;
|
|
662
|
+
product_id: number;
|
|
663
|
+
name: string;
|
|
664
|
+
description?: string;
|
|
665
|
+
quantity: number;
|
|
666
|
+
position: number;
|
|
667
|
+
created_at: string;
|
|
668
|
+
updated_at: string;
|
|
669
|
+
}
|
|
670
|
+
interface CreateBundleGroupRequest {
|
|
671
|
+
name: string;
|
|
672
|
+
description?: string;
|
|
673
|
+
quantity: number;
|
|
674
|
+
position?: number;
|
|
675
|
+
}
|
|
676
|
+
interface BundleCollection {
|
|
677
|
+
collection_id: number;
|
|
678
|
+
site_id: string;
|
|
679
|
+
site_name: string;
|
|
680
|
+
name: string;
|
|
681
|
+
description?: string;
|
|
682
|
+
available_from?: string;
|
|
683
|
+
available_until?: string;
|
|
684
|
+
published: number;
|
|
685
|
+
created_at: string;
|
|
686
|
+
updated_at: string;
|
|
687
|
+
}
|
|
688
|
+
interface CreateBundleCollectionRequest {
|
|
689
|
+
name: string;
|
|
690
|
+
description?: string;
|
|
691
|
+
available_from?: string;
|
|
692
|
+
available_until?: string;
|
|
693
|
+
published?: number;
|
|
694
|
+
}
|
|
695
|
+
interface BundleCollectionItem {
|
|
696
|
+
id: number;
|
|
697
|
+
collection_id: number;
|
|
698
|
+
product_id: number;
|
|
699
|
+
max_quantity?: number;
|
|
700
|
+
position: number;
|
|
701
|
+
created_at: string;
|
|
702
|
+
updated_at: string;
|
|
703
|
+
}
|
|
704
|
+
interface BundleCollectionItemWithProduct extends BundleCollectionItem {
|
|
705
|
+
product_name: string;
|
|
706
|
+
slug: string;
|
|
707
|
+
unit_amount: number;
|
|
708
|
+
currency: string;
|
|
709
|
+
image_url?: string;
|
|
710
|
+
}
|
|
711
|
+
interface AddCollectionItemRequest {
|
|
712
|
+
product_id: number;
|
|
713
|
+
max_quantity?: number;
|
|
714
|
+
position?: number;
|
|
715
|
+
}
|
|
643
716
|
interface ApiError {
|
|
644
717
|
message: string;
|
|
645
718
|
code?: string;
|
|
@@ -2291,6 +2364,35 @@ declare class SiteUsersClient extends BaseClient {
|
|
|
2291
2364
|
success: boolean;
|
|
2292
2365
|
message: string;
|
|
2293
2366
|
}>>;
|
|
2367
|
+
/**
|
|
2368
|
+
* Pause a subscription via Stripe pause_collection
|
|
2369
|
+
* @param siteName - The site name
|
|
2370
|
+
* @param subscriptionId - Subscription ID
|
|
2371
|
+
* @param csrfToken - CSRF token (required)
|
|
2372
|
+
* @param resumesAt - Optional ISO date string when subscription should auto-resume
|
|
2373
|
+
*/
|
|
2374
|
+
pauseSubscription(siteName: string, subscriptionId: string, csrfToken?: string, resumesAt?: string): Promise<ApiResponse<{
|
|
2375
|
+
success: boolean;
|
|
2376
|
+
}>>;
|
|
2377
|
+
/**
|
|
2378
|
+
* Resume a paused subscription
|
|
2379
|
+
* @param siteName - The site name
|
|
2380
|
+
* @param subscriptionId - Subscription ID
|
|
2381
|
+
* @param csrfToken - CSRF token (required)
|
|
2382
|
+
*/
|
|
2383
|
+
resumeSubscription(siteName: string, subscriptionId: string, csrfToken?: string): Promise<ApiResponse<{
|
|
2384
|
+
success: boolean;
|
|
2385
|
+
}>>;
|
|
2386
|
+
/**
|
|
2387
|
+
* Change subscription plan tier
|
|
2388
|
+
* @param siteName - The site name
|
|
2389
|
+
* @param subscriptionId - Subscription ID
|
|
2390
|
+
* @param productId - New product ID to switch to
|
|
2391
|
+
* @param csrfToken - CSRF token (required)
|
|
2392
|
+
*/
|
|
2393
|
+
changeSubscriptionPlan(siteName: string, subscriptionId: string, productId: number, csrfToken?: string): Promise<ApiResponse<{
|
|
2394
|
+
success: boolean;
|
|
2395
|
+
}>>;
|
|
2294
2396
|
/**
|
|
2295
2397
|
* Get linked newsletter subscriptions
|
|
2296
2398
|
* @param siteName - The site name
|
|
@@ -2298,6 +2400,20 @@ declare class SiteUsersClient extends BaseClient {
|
|
|
2298
2400
|
getNewsletterSubscriptions(siteName: string): Promise<ApiResponse<{
|
|
2299
2401
|
newsletters: any[];
|
|
2300
2402
|
}>>;
|
|
2403
|
+
/**
|
|
2404
|
+
* Get current credit balance
|
|
2405
|
+
* @param siteName - The site name
|
|
2406
|
+
*/
|
|
2407
|
+
getCreditBalance(siteName: string): Promise<ApiResponse<CreditBalance>>;
|
|
2408
|
+
/**
|
|
2409
|
+
* Get credit balance and paginated transactions
|
|
2410
|
+
* @param siteName - The site name
|
|
2411
|
+
* @param params - Pagination params
|
|
2412
|
+
*/
|
|
2413
|
+
getCreditTransactions(siteName: string, params?: {
|
|
2414
|
+
limit?: number;
|
|
2415
|
+
offset?: number;
|
|
2416
|
+
}): Promise<ApiResponse<CreditBalanceWithTransactions>>;
|
|
2301
2417
|
/**
|
|
2302
2418
|
* List all site users (admin only)
|
|
2303
2419
|
* @param siteName - The site name
|
|
@@ -2331,6 +2447,39 @@ declare class SiteUsersClient extends BaseClient {
|
|
|
2331
2447
|
}>>;
|
|
2332
2448
|
}
|
|
2333
2449
|
|
|
2450
|
+
/**
|
|
2451
|
+
* Bundles & Collections client for PerspectAPI SDK
|
|
2452
|
+
*/
|
|
2453
|
+
|
|
2454
|
+
declare class BundlesClient extends BaseClient {
|
|
2455
|
+
constructor(http: any, cache?: CacheManager);
|
|
2456
|
+
getBundleGroups(siteName: string, productId: number, cachePolicy?: CachePolicy): Promise<ApiResponse<ProductBundleGroup[]>>;
|
|
2457
|
+
createBundleGroup(siteName: string, productId: number, data: CreateBundleGroupRequest): Promise<ApiResponse<ProductBundleGroup>>;
|
|
2458
|
+
updateBundleGroup(siteName: string, productId: number, bundleGroupId: number, data: Partial<CreateBundleGroupRequest>): Promise<ApiResponse<ProductBundleGroup>>;
|
|
2459
|
+
deleteBundleGroup(siteName: string, productId: number, bundleGroupId: number): Promise<ApiResponse<{
|
|
2460
|
+
message: string;
|
|
2461
|
+
}>>;
|
|
2462
|
+
getCollections(siteName: string, cachePolicy?: CachePolicy): Promise<ApiResponse<BundleCollection[]>>;
|
|
2463
|
+
getCurrentCollection(siteName: string, cachePolicy?: CachePolicy): Promise<ApiResponse<BundleCollection & {
|
|
2464
|
+
items: BundleCollectionItemWithProduct[];
|
|
2465
|
+
}>>;
|
|
2466
|
+
getCollection(siteName: string, collectionId: number, cachePolicy?: CachePolicy): Promise<ApiResponse<BundleCollection & {
|
|
2467
|
+
items: BundleCollectionItemWithProduct[];
|
|
2468
|
+
}>>;
|
|
2469
|
+
createCollection(siteName: string, data: CreateBundleCollectionRequest): Promise<ApiResponse<BundleCollection>>;
|
|
2470
|
+
updateCollection(siteName: string, collectionId: number, data: Partial<CreateBundleCollectionRequest>): Promise<ApiResponse<BundleCollection>>;
|
|
2471
|
+
deleteCollection(siteName: string, collectionId: number): Promise<ApiResponse<{
|
|
2472
|
+
message: string;
|
|
2473
|
+
}>>;
|
|
2474
|
+
getCollectionItems(siteName: string, collectionId: number, cachePolicy?: CachePolicy): Promise<ApiResponse<BundleCollectionItemWithProduct[]>>;
|
|
2475
|
+
addCollectionItem(siteName: string, collectionId: number, data: AddCollectionItemRequest): Promise<ApiResponse<BundleCollectionItem>>;
|
|
2476
|
+
removeCollectionItem(siteName: string, collectionId: number, itemId: number): Promise<ApiResponse<{
|
|
2477
|
+
message: string;
|
|
2478
|
+
}>>;
|
|
2479
|
+
private buildBundleTags;
|
|
2480
|
+
private buildCollectionTags;
|
|
2481
|
+
}
|
|
2482
|
+
|
|
2334
2483
|
/**
|
|
2335
2484
|
* Main PerspectAPI SDK Client
|
|
2336
2485
|
* Cloudflare Workers compatible TypeScript SDK
|
|
@@ -2351,6 +2500,7 @@ declare class PerspectApiClient {
|
|
|
2351
2500
|
readonly contact: ContactClient;
|
|
2352
2501
|
readonly newsletter: NewsletterClient;
|
|
2353
2502
|
readonly siteUsers: SiteUsersClient;
|
|
2503
|
+
readonly bundles: BundlesClient;
|
|
2354
2504
|
constructor(config: PerspectApiConfig);
|
|
2355
2505
|
/**
|
|
2356
2506
|
* Update authentication token
|
|
@@ -2755,4 +2905,4 @@ declare function createCheckoutSession(options: CheckoutSessionOptions): Promise
|
|
|
2755
2905
|
error: string;
|
|
2756
2906
|
}>;
|
|
2757
2907
|
|
|
2758
|
-
export { type ApiError, type ApiKey, ApiKeysClient, type ApiResponse, AuthClient, BaseClient, type BlogPost, type CacheConfig, CacheManager, CategoriesClient, type Category, type CategorySummary, type CheckoutAddress, CheckoutClient, type CheckoutMetadata, type CheckoutMetadataValue, type CheckoutSession, type CheckoutSessionOptions, type CheckoutSessionTax, type CheckoutTaxBreakdownItem, type CheckoutTaxCustomerExemptionRequest, type CheckoutTaxExemptionStatus, type CheckoutTaxRequest, type CheckoutTaxStrategy, ContactClient, type ContactStatusResponse, type ContactSubmission, type ContactSubmitResponse, type Content, type ContentCategoryResponse, ContentClient, type ContentQueryParams, type ContentStatus, type ContentType, type CreateApiKeyRequest, type CreateCategoryRequest, type CreateCheckoutSessionRequest, type CreateContactRequest, type CreateContentRequest, type CreateNewsletterSubscriptionRequest, type CreateOrganizationRequest, type CreatePaymentGatewayRequest, type CreateProductRequest, type CreateSiteRequest, type CreateWebhookRequest, DEFAULT_IMAGE_SIZES, HttpClient, type HttpMethod, type ImageTransformOptions, InMemoryCacheAdapter, type LoadContentBySlugOptions, type LoadContentOptions, type LoadProductBySlugOptions, type LoadProductsOptions, type LoaderLogger, type LoaderOptions, type MediaItem, NewsletterClient, type NewsletterConfirmResponse, type NewsletterList, type NewsletterPreferences, type NewsletterStatusResponse, type NewsletterSubscribeResponse, type NewsletterSubscription, type NewsletterUnsubscribeRequest, type NewsletterUnsubscribeResponse, NoopCacheAdapter, type Organization, OrganizationsClient, type PaginatedResponse, type PaginationParams, type PaymentGateway, PerspectApiClient, type PerspectApiConfig, type Product, type ProductQueryParams, ProductsClient, type RequestOptions, type RequestOtpRequest, type ResponsiveImageSizes, type SetProfileValueRequest, type Site, type SiteUser, type SiteUserOrder, type SiteUserProfile, type SiteUserSubscription, SiteUsersClient, SitesClient, type UpdateApiKeyRequest, type UpdateContentRequest, type UpdateSiteUserRequest, type User, type VerifyOtpRequest, type VerifyOtpResponse, type Webhook, WebhooksClient, buildImageUrl, createApiError, createCheckoutSession, createPerspectApiClient, PerspectApiClient as default, generateResponsiveImageHtml, generateResponsiveUrls, generateSizesAttribute, generateSrcSet, loadAllContent, loadContentBySlug, loadPages, loadPosts, loadProductBySlug, loadProducts, transformContent, transformMediaItem, transformProduct };
|
|
2908
|
+
export { type AddCollectionItemRequest, type ApiError, type ApiKey, ApiKeysClient, type ApiResponse, AuthClient, BaseClient, type BlogPost, type BundleCollection, type BundleCollectionItem, type BundleCollectionItemWithProduct, BundlesClient, type CacheConfig, CacheManager, CategoriesClient, type Category, type CategorySummary, type CheckoutAddress, CheckoutClient, type CheckoutMetadata, type CheckoutMetadataValue, type CheckoutSession, type CheckoutSessionOptions, type CheckoutSessionTax, type CheckoutTaxBreakdownItem, type CheckoutTaxCustomerExemptionRequest, type CheckoutTaxExemptionStatus, type CheckoutTaxRequest, type CheckoutTaxStrategy, ContactClient, type ContactStatusResponse, type ContactSubmission, type ContactSubmitResponse, type Content, type ContentCategoryResponse, ContentClient, type ContentQueryParams, type ContentStatus, type ContentType, type CreateApiKeyRequest, type CreateBundleCollectionRequest, type CreateBundleGroupRequest, type CreateCategoryRequest, type CreateCheckoutSessionRequest, type CreateContactRequest, type CreateContentRequest, type CreateNewsletterSubscriptionRequest, type CreateOrganizationRequest, type CreatePaymentGatewayRequest, type CreateProductRequest, type CreateSiteRequest, type CreateWebhookRequest, type CreditBalance, type CreditBalanceWithTransactions, type CreditTransaction, DEFAULT_IMAGE_SIZES, HttpClient, type HttpMethod, type ImageTransformOptions, InMemoryCacheAdapter, type LoadContentBySlugOptions, type LoadContentOptions, type LoadProductBySlugOptions, type LoadProductsOptions, type LoaderLogger, type LoaderOptions, type MediaItem, NewsletterClient, type NewsletterConfirmResponse, type NewsletterList, type NewsletterPreferences, type NewsletterStatusResponse, type NewsletterSubscribeResponse, type NewsletterSubscription, type NewsletterUnsubscribeRequest, type NewsletterUnsubscribeResponse, NoopCacheAdapter, type Organization, OrganizationsClient, type PaginatedResponse, type PaginationParams, type PaymentGateway, PerspectApiClient, type PerspectApiConfig, type Product, type ProductBundleGroup, type ProductQueryParams, ProductsClient, type RequestOptions, type RequestOtpRequest, type ResponsiveImageSizes, type SetProfileValueRequest, type Site, type SiteUser, type SiteUserOrder, type SiteUserProfile, type SiteUserSubscription, SiteUsersClient, SitesClient, type UpdateApiKeyRequest, type UpdateContentRequest, type UpdateSiteUserRequest, type User, type VerifyOtpRequest, type VerifyOtpResponse, type Webhook, WebhooksClient, buildImageUrl, createApiError, createCheckoutSession, createPerspectApiClient, PerspectApiClient as default, generateResponsiveImageHtml, generateResponsiveUrls, generateSizesAttribute, generateSrcSet, loadAllContent, loadContentBySlug, loadPages, loadPosts, loadProductBySlug, loadProducts, transformContent, transformMediaItem, transformProduct };
|
package/dist/index.d.ts
CHANGED
|
@@ -472,6 +472,7 @@ interface CreateCheckoutSessionRequest {
|
|
|
472
472
|
price?: string;
|
|
473
473
|
quantity: number;
|
|
474
474
|
sku_id?: number;
|
|
475
|
+
product_id?: number;
|
|
475
476
|
price_data?: {
|
|
476
477
|
currency: string;
|
|
477
478
|
product_data: {
|
|
@@ -489,6 +490,8 @@ interface CreateCheckoutSessionRequest {
|
|
|
489
490
|
customer_email?: string;
|
|
490
491
|
customerEmail?: string;
|
|
491
492
|
site_user_id?: string;
|
|
493
|
+
referral_code?: string;
|
|
494
|
+
referrer_site_user_id?: string;
|
|
492
495
|
currency?: string;
|
|
493
496
|
metadata?: CheckoutMetadata;
|
|
494
497
|
mode?: 'payment' | 'subscription' | 'setup';
|
|
@@ -609,7 +612,21 @@ interface SiteUserOrder {
|
|
|
609
612
|
payment_status?: string;
|
|
610
613
|
line_items: any[];
|
|
611
614
|
created_at: string;
|
|
612
|
-
|
|
615
|
+
completed_at?: string;
|
|
616
|
+
}
|
|
617
|
+
interface CreditTransaction {
|
|
618
|
+
id: number;
|
|
619
|
+
amount_cents: number;
|
|
620
|
+
balance_after_cents: number;
|
|
621
|
+
type: string;
|
|
622
|
+
description: string | null;
|
|
623
|
+
created_at: string;
|
|
624
|
+
}
|
|
625
|
+
interface CreditBalance {
|
|
626
|
+
balance_cents: number;
|
|
627
|
+
}
|
|
628
|
+
interface CreditBalanceWithTransactions extends CreditBalance {
|
|
629
|
+
transactions: CreditTransaction[];
|
|
613
630
|
}
|
|
614
631
|
interface RequestOtpRequest {
|
|
615
632
|
email: string;
|
|
@@ -640,6 +657,62 @@ interface UpdateSiteUserRequest {
|
|
|
640
657
|
interface SetProfileValueRequest {
|
|
641
658
|
value: string;
|
|
642
659
|
}
|
|
660
|
+
interface ProductBundleGroup {
|
|
661
|
+
bundle_group_id: number;
|
|
662
|
+
product_id: number;
|
|
663
|
+
name: string;
|
|
664
|
+
description?: string;
|
|
665
|
+
quantity: number;
|
|
666
|
+
position: number;
|
|
667
|
+
created_at: string;
|
|
668
|
+
updated_at: string;
|
|
669
|
+
}
|
|
670
|
+
interface CreateBundleGroupRequest {
|
|
671
|
+
name: string;
|
|
672
|
+
description?: string;
|
|
673
|
+
quantity: number;
|
|
674
|
+
position?: number;
|
|
675
|
+
}
|
|
676
|
+
interface BundleCollection {
|
|
677
|
+
collection_id: number;
|
|
678
|
+
site_id: string;
|
|
679
|
+
site_name: string;
|
|
680
|
+
name: string;
|
|
681
|
+
description?: string;
|
|
682
|
+
available_from?: string;
|
|
683
|
+
available_until?: string;
|
|
684
|
+
published: number;
|
|
685
|
+
created_at: string;
|
|
686
|
+
updated_at: string;
|
|
687
|
+
}
|
|
688
|
+
interface CreateBundleCollectionRequest {
|
|
689
|
+
name: string;
|
|
690
|
+
description?: string;
|
|
691
|
+
available_from?: string;
|
|
692
|
+
available_until?: string;
|
|
693
|
+
published?: number;
|
|
694
|
+
}
|
|
695
|
+
interface BundleCollectionItem {
|
|
696
|
+
id: number;
|
|
697
|
+
collection_id: number;
|
|
698
|
+
product_id: number;
|
|
699
|
+
max_quantity?: number;
|
|
700
|
+
position: number;
|
|
701
|
+
created_at: string;
|
|
702
|
+
updated_at: string;
|
|
703
|
+
}
|
|
704
|
+
interface BundleCollectionItemWithProduct extends BundleCollectionItem {
|
|
705
|
+
product_name: string;
|
|
706
|
+
slug: string;
|
|
707
|
+
unit_amount: number;
|
|
708
|
+
currency: string;
|
|
709
|
+
image_url?: string;
|
|
710
|
+
}
|
|
711
|
+
interface AddCollectionItemRequest {
|
|
712
|
+
product_id: number;
|
|
713
|
+
max_quantity?: number;
|
|
714
|
+
position?: number;
|
|
715
|
+
}
|
|
643
716
|
interface ApiError {
|
|
644
717
|
message: string;
|
|
645
718
|
code?: string;
|
|
@@ -2291,6 +2364,35 @@ declare class SiteUsersClient extends BaseClient {
|
|
|
2291
2364
|
success: boolean;
|
|
2292
2365
|
message: string;
|
|
2293
2366
|
}>>;
|
|
2367
|
+
/**
|
|
2368
|
+
* Pause a subscription via Stripe pause_collection
|
|
2369
|
+
* @param siteName - The site name
|
|
2370
|
+
* @param subscriptionId - Subscription ID
|
|
2371
|
+
* @param csrfToken - CSRF token (required)
|
|
2372
|
+
* @param resumesAt - Optional ISO date string when subscription should auto-resume
|
|
2373
|
+
*/
|
|
2374
|
+
pauseSubscription(siteName: string, subscriptionId: string, csrfToken?: string, resumesAt?: string): Promise<ApiResponse<{
|
|
2375
|
+
success: boolean;
|
|
2376
|
+
}>>;
|
|
2377
|
+
/**
|
|
2378
|
+
* Resume a paused subscription
|
|
2379
|
+
* @param siteName - The site name
|
|
2380
|
+
* @param subscriptionId - Subscription ID
|
|
2381
|
+
* @param csrfToken - CSRF token (required)
|
|
2382
|
+
*/
|
|
2383
|
+
resumeSubscription(siteName: string, subscriptionId: string, csrfToken?: string): Promise<ApiResponse<{
|
|
2384
|
+
success: boolean;
|
|
2385
|
+
}>>;
|
|
2386
|
+
/**
|
|
2387
|
+
* Change subscription plan tier
|
|
2388
|
+
* @param siteName - The site name
|
|
2389
|
+
* @param subscriptionId - Subscription ID
|
|
2390
|
+
* @param productId - New product ID to switch to
|
|
2391
|
+
* @param csrfToken - CSRF token (required)
|
|
2392
|
+
*/
|
|
2393
|
+
changeSubscriptionPlan(siteName: string, subscriptionId: string, productId: number, csrfToken?: string): Promise<ApiResponse<{
|
|
2394
|
+
success: boolean;
|
|
2395
|
+
}>>;
|
|
2294
2396
|
/**
|
|
2295
2397
|
* Get linked newsletter subscriptions
|
|
2296
2398
|
* @param siteName - The site name
|
|
@@ -2298,6 +2400,20 @@ declare class SiteUsersClient extends BaseClient {
|
|
|
2298
2400
|
getNewsletterSubscriptions(siteName: string): Promise<ApiResponse<{
|
|
2299
2401
|
newsletters: any[];
|
|
2300
2402
|
}>>;
|
|
2403
|
+
/**
|
|
2404
|
+
* Get current credit balance
|
|
2405
|
+
* @param siteName - The site name
|
|
2406
|
+
*/
|
|
2407
|
+
getCreditBalance(siteName: string): Promise<ApiResponse<CreditBalance>>;
|
|
2408
|
+
/**
|
|
2409
|
+
* Get credit balance and paginated transactions
|
|
2410
|
+
* @param siteName - The site name
|
|
2411
|
+
* @param params - Pagination params
|
|
2412
|
+
*/
|
|
2413
|
+
getCreditTransactions(siteName: string, params?: {
|
|
2414
|
+
limit?: number;
|
|
2415
|
+
offset?: number;
|
|
2416
|
+
}): Promise<ApiResponse<CreditBalanceWithTransactions>>;
|
|
2301
2417
|
/**
|
|
2302
2418
|
* List all site users (admin only)
|
|
2303
2419
|
* @param siteName - The site name
|
|
@@ -2331,6 +2447,39 @@ declare class SiteUsersClient extends BaseClient {
|
|
|
2331
2447
|
}>>;
|
|
2332
2448
|
}
|
|
2333
2449
|
|
|
2450
|
+
/**
|
|
2451
|
+
* Bundles & Collections client for PerspectAPI SDK
|
|
2452
|
+
*/
|
|
2453
|
+
|
|
2454
|
+
declare class BundlesClient extends BaseClient {
|
|
2455
|
+
constructor(http: any, cache?: CacheManager);
|
|
2456
|
+
getBundleGroups(siteName: string, productId: number, cachePolicy?: CachePolicy): Promise<ApiResponse<ProductBundleGroup[]>>;
|
|
2457
|
+
createBundleGroup(siteName: string, productId: number, data: CreateBundleGroupRequest): Promise<ApiResponse<ProductBundleGroup>>;
|
|
2458
|
+
updateBundleGroup(siteName: string, productId: number, bundleGroupId: number, data: Partial<CreateBundleGroupRequest>): Promise<ApiResponse<ProductBundleGroup>>;
|
|
2459
|
+
deleteBundleGroup(siteName: string, productId: number, bundleGroupId: number): Promise<ApiResponse<{
|
|
2460
|
+
message: string;
|
|
2461
|
+
}>>;
|
|
2462
|
+
getCollections(siteName: string, cachePolicy?: CachePolicy): Promise<ApiResponse<BundleCollection[]>>;
|
|
2463
|
+
getCurrentCollection(siteName: string, cachePolicy?: CachePolicy): Promise<ApiResponse<BundleCollection & {
|
|
2464
|
+
items: BundleCollectionItemWithProduct[];
|
|
2465
|
+
}>>;
|
|
2466
|
+
getCollection(siteName: string, collectionId: number, cachePolicy?: CachePolicy): Promise<ApiResponse<BundleCollection & {
|
|
2467
|
+
items: BundleCollectionItemWithProduct[];
|
|
2468
|
+
}>>;
|
|
2469
|
+
createCollection(siteName: string, data: CreateBundleCollectionRequest): Promise<ApiResponse<BundleCollection>>;
|
|
2470
|
+
updateCollection(siteName: string, collectionId: number, data: Partial<CreateBundleCollectionRequest>): Promise<ApiResponse<BundleCollection>>;
|
|
2471
|
+
deleteCollection(siteName: string, collectionId: number): Promise<ApiResponse<{
|
|
2472
|
+
message: string;
|
|
2473
|
+
}>>;
|
|
2474
|
+
getCollectionItems(siteName: string, collectionId: number, cachePolicy?: CachePolicy): Promise<ApiResponse<BundleCollectionItemWithProduct[]>>;
|
|
2475
|
+
addCollectionItem(siteName: string, collectionId: number, data: AddCollectionItemRequest): Promise<ApiResponse<BundleCollectionItem>>;
|
|
2476
|
+
removeCollectionItem(siteName: string, collectionId: number, itemId: number): Promise<ApiResponse<{
|
|
2477
|
+
message: string;
|
|
2478
|
+
}>>;
|
|
2479
|
+
private buildBundleTags;
|
|
2480
|
+
private buildCollectionTags;
|
|
2481
|
+
}
|
|
2482
|
+
|
|
2334
2483
|
/**
|
|
2335
2484
|
* Main PerspectAPI SDK Client
|
|
2336
2485
|
* Cloudflare Workers compatible TypeScript SDK
|
|
@@ -2351,6 +2500,7 @@ declare class PerspectApiClient {
|
|
|
2351
2500
|
readonly contact: ContactClient;
|
|
2352
2501
|
readonly newsletter: NewsletterClient;
|
|
2353
2502
|
readonly siteUsers: SiteUsersClient;
|
|
2503
|
+
readonly bundles: BundlesClient;
|
|
2354
2504
|
constructor(config: PerspectApiConfig);
|
|
2355
2505
|
/**
|
|
2356
2506
|
* Update authentication token
|
|
@@ -2755,4 +2905,4 @@ declare function createCheckoutSession(options: CheckoutSessionOptions): Promise
|
|
|
2755
2905
|
error: string;
|
|
2756
2906
|
}>;
|
|
2757
2907
|
|
|
2758
|
-
export { type ApiError, type ApiKey, ApiKeysClient, type ApiResponse, AuthClient, BaseClient, type BlogPost, type CacheConfig, CacheManager, CategoriesClient, type Category, type CategorySummary, type CheckoutAddress, CheckoutClient, type CheckoutMetadata, type CheckoutMetadataValue, type CheckoutSession, type CheckoutSessionOptions, type CheckoutSessionTax, type CheckoutTaxBreakdownItem, type CheckoutTaxCustomerExemptionRequest, type CheckoutTaxExemptionStatus, type CheckoutTaxRequest, type CheckoutTaxStrategy, ContactClient, type ContactStatusResponse, type ContactSubmission, type ContactSubmitResponse, type Content, type ContentCategoryResponse, ContentClient, type ContentQueryParams, type ContentStatus, type ContentType, type CreateApiKeyRequest, type CreateCategoryRequest, type CreateCheckoutSessionRequest, type CreateContactRequest, type CreateContentRequest, type CreateNewsletterSubscriptionRequest, type CreateOrganizationRequest, type CreatePaymentGatewayRequest, type CreateProductRequest, type CreateSiteRequest, type CreateWebhookRequest, DEFAULT_IMAGE_SIZES, HttpClient, type HttpMethod, type ImageTransformOptions, InMemoryCacheAdapter, type LoadContentBySlugOptions, type LoadContentOptions, type LoadProductBySlugOptions, type LoadProductsOptions, type LoaderLogger, type LoaderOptions, type MediaItem, NewsletterClient, type NewsletterConfirmResponse, type NewsletterList, type NewsletterPreferences, type NewsletterStatusResponse, type NewsletterSubscribeResponse, type NewsletterSubscription, type NewsletterUnsubscribeRequest, type NewsletterUnsubscribeResponse, NoopCacheAdapter, type Organization, OrganizationsClient, type PaginatedResponse, type PaginationParams, type PaymentGateway, PerspectApiClient, type PerspectApiConfig, type Product, type ProductQueryParams, ProductsClient, type RequestOptions, type RequestOtpRequest, type ResponsiveImageSizes, type SetProfileValueRequest, type Site, type SiteUser, type SiteUserOrder, type SiteUserProfile, type SiteUserSubscription, SiteUsersClient, SitesClient, type UpdateApiKeyRequest, type UpdateContentRequest, type UpdateSiteUserRequest, type User, type VerifyOtpRequest, type VerifyOtpResponse, type Webhook, WebhooksClient, buildImageUrl, createApiError, createCheckoutSession, createPerspectApiClient, PerspectApiClient as default, generateResponsiveImageHtml, generateResponsiveUrls, generateSizesAttribute, generateSrcSet, loadAllContent, loadContentBySlug, loadPages, loadPosts, loadProductBySlug, loadProducts, transformContent, transformMediaItem, transformProduct };
|
|
2908
|
+
export { type AddCollectionItemRequest, type ApiError, type ApiKey, ApiKeysClient, type ApiResponse, AuthClient, BaseClient, type BlogPost, type BundleCollection, type BundleCollectionItem, type BundleCollectionItemWithProduct, BundlesClient, type CacheConfig, CacheManager, CategoriesClient, type Category, type CategorySummary, type CheckoutAddress, CheckoutClient, type CheckoutMetadata, type CheckoutMetadataValue, type CheckoutSession, type CheckoutSessionOptions, type CheckoutSessionTax, type CheckoutTaxBreakdownItem, type CheckoutTaxCustomerExemptionRequest, type CheckoutTaxExemptionStatus, type CheckoutTaxRequest, type CheckoutTaxStrategy, ContactClient, type ContactStatusResponse, type ContactSubmission, type ContactSubmitResponse, type Content, type ContentCategoryResponse, ContentClient, type ContentQueryParams, type ContentStatus, type ContentType, type CreateApiKeyRequest, type CreateBundleCollectionRequest, type CreateBundleGroupRequest, type CreateCategoryRequest, type CreateCheckoutSessionRequest, type CreateContactRequest, type CreateContentRequest, type CreateNewsletterSubscriptionRequest, type CreateOrganizationRequest, type CreatePaymentGatewayRequest, type CreateProductRequest, type CreateSiteRequest, type CreateWebhookRequest, type CreditBalance, type CreditBalanceWithTransactions, type CreditTransaction, DEFAULT_IMAGE_SIZES, HttpClient, type HttpMethod, type ImageTransformOptions, InMemoryCacheAdapter, type LoadContentBySlugOptions, type LoadContentOptions, type LoadProductBySlugOptions, type LoadProductsOptions, type LoaderLogger, type LoaderOptions, type MediaItem, NewsletterClient, type NewsletterConfirmResponse, type NewsletterList, type NewsletterPreferences, type NewsletterStatusResponse, type NewsletterSubscribeResponse, type NewsletterSubscription, type NewsletterUnsubscribeRequest, type NewsletterUnsubscribeResponse, NoopCacheAdapter, type Organization, OrganizationsClient, type PaginatedResponse, type PaginationParams, type PaymentGateway, PerspectApiClient, type PerspectApiConfig, type Product, type ProductBundleGroup, type ProductQueryParams, ProductsClient, type RequestOptions, type RequestOtpRequest, type ResponsiveImageSizes, type SetProfileValueRequest, type Site, type SiteUser, type SiteUserOrder, type SiteUserProfile, type SiteUserSubscription, SiteUsersClient, SitesClient, type UpdateApiKeyRequest, type UpdateContentRequest, type UpdateSiteUserRequest, type User, type VerifyOtpRequest, type VerifyOtpResponse, type Webhook, WebhooksClient, buildImageUrl, createApiError, createCheckoutSession, createPerspectApiClient, PerspectApiClient as default, generateResponsiveImageHtml, generateResponsiveUrls, generateSizesAttribute, generateSrcSet, loadAllContent, loadContentBySlug, loadPages, loadPosts, loadProductBySlug, loadProducts, transformContent, transformMediaItem, transformProduct };
|