perspectapi-ts-sdk 5.4.5 → 6.0.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 +235 -2
- package/dist/index.d.ts +235 -2
- package/dist/index.js +207 -12
- package/dist/index.mjs +207 -12
- package/package.json +1 -1
- package/src/cache/cache-manager.ts +2 -8
- package/src/index.ts +1 -0
- package/src/v2/client/base-v2-client.ts +6 -0
- package/src/v2/client/content-client.ts +125 -4
- package/src/v2/client/newsletter-client.ts +85 -1
- package/src/v2/client/orders-client.ts +27 -1
- package/src/v2/client/site-users-client.ts +76 -3
- package/src/v2/types.ts +192 -0
package/dist/index.d.mts
CHANGED
|
@@ -3284,6 +3284,82 @@ interface V2OrderListParams extends V2PaginationParams {
|
|
|
3284
3284
|
date_from?: string;
|
|
3285
3285
|
date_to?: string;
|
|
3286
3286
|
}
|
|
3287
|
+
interface V2OrderLineItemPriceData {
|
|
3288
|
+
currency: string;
|
|
3289
|
+
product_data: {
|
|
3290
|
+
name: string;
|
|
3291
|
+
description?: string;
|
|
3292
|
+
images?: string[];
|
|
3293
|
+
};
|
|
3294
|
+
unit_amount: number;
|
|
3295
|
+
}
|
|
3296
|
+
interface V2OrderLineItem {
|
|
3297
|
+
sku_id?: number;
|
|
3298
|
+
product_id?: number;
|
|
3299
|
+
price_data?: V2OrderLineItemPriceData;
|
|
3300
|
+
price?: string;
|
|
3301
|
+
quantity: number;
|
|
3302
|
+
}
|
|
3303
|
+
interface V2OrderAddress {
|
|
3304
|
+
line1?: string;
|
|
3305
|
+
line2?: string;
|
|
3306
|
+
city?: string;
|
|
3307
|
+
state?: string;
|
|
3308
|
+
postal_code?: string;
|
|
3309
|
+
country?: string;
|
|
3310
|
+
}
|
|
3311
|
+
interface V2OrderTaxRequest {
|
|
3312
|
+
strategy?: string;
|
|
3313
|
+
customer_identifier?: string;
|
|
3314
|
+
customer_profile_id?: string;
|
|
3315
|
+
customer_display_name?: string;
|
|
3316
|
+
allow_exemption?: boolean;
|
|
3317
|
+
save_profile?: boolean;
|
|
3318
|
+
customer_exemption?: {
|
|
3319
|
+
status?: "none" | "exempt" | "reverse_charge";
|
|
3320
|
+
reason?: string;
|
|
3321
|
+
tax_id?: string;
|
|
3322
|
+
tax_id_type?: string;
|
|
3323
|
+
certificate_url?: string;
|
|
3324
|
+
metadata?: Record<string, unknown>;
|
|
3325
|
+
expires_at?: string;
|
|
3326
|
+
};
|
|
3327
|
+
}
|
|
3328
|
+
interface V2OrderCreateParams {
|
|
3329
|
+
line_items: V2OrderLineItem[];
|
|
3330
|
+
success_url: string;
|
|
3331
|
+
cancel_url: string;
|
|
3332
|
+
customer_email?: string;
|
|
3333
|
+
site_user_id?: string;
|
|
3334
|
+
mode?: "payment" | "subscription";
|
|
3335
|
+
metadata?: Record<string, string | number | boolean>;
|
|
3336
|
+
tax?: V2OrderTaxRequest;
|
|
3337
|
+
shipping_amount?: number;
|
|
3338
|
+
shipping_address?: V2OrderAddress;
|
|
3339
|
+
billing_address?: V2OrderAddress;
|
|
3340
|
+
currency?: string;
|
|
3341
|
+
referral_code?: string;
|
|
3342
|
+
referrer_site_user_id?: string;
|
|
3343
|
+
}
|
|
3344
|
+
interface V2OrderCreateResult extends V2Object {
|
|
3345
|
+
object: "checkout_session";
|
|
3346
|
+
checkout_url: string | null;
|
|
3347
|
+
payment_status: string | null;
|
|
3348
|
+
tax: {
|
|
3349
|
+
amount: number;
|
|
3350
|
+
currency: string;
|
|
3351
|
+
strategy: string;
|
|
3352
|
+
exemption_applied: boolean;
|
|
3353
|
+
exemption_status: string;
|
|
3354
|
+
breakdown: Array<{
|
|
3355
|
+
jurisdiction?: string;
|
|
3356
|
+
rate_percent: number;
|
|
3357
|
+
tax_amount: number;
|
|
3358
|
+
taxable_amount: number;
|
|
3359
|
+
source: string;
|
|
3360
|
+
}>;
|
|
3361
|
+
};
|
|
3362
|
+
}
|
|
3287
3363
|
interface V2SiteUser extends V2Object {
|
|
3288
3364
|
object: "site_user";
|
|
3289
3365
|
email: string;
|
|
@@ -3305,10 +3381,37 @@ interface V2SiteUserUpdateParams {
|
|
|
3305
3381
|
status?: "active" | "suspended" | "pending_verification";
|
|
3306
3382
|
metadata?: Record<string, unknown>;
|
|
3307
3383
|
}
|
|
3384
|
+
/**
|
|
3385
|
+
* Patch shape for the authenticated `/me` endpoint. Unlike the admin update,
|
|
3386
|
+
* end users cannot change their own `status`.
|
|
3387
|
+
*/
|
|
3388
|
+
interface V2SiteUserMeUpdateParams {
|
|
3389
|
+
first_name?: string;
|
|
3390
|
+
last_name?: string;
|
|
3391
|
+
avatar_url?: string;
|
|
3392
|
+
metadata?: Record<string, unknown>;
|
|
3393
|
+
}
|
|
3308
3394
|
interface V2SiteUserListParams extends V2PaginationParams {
|
|
3309
3395
|
status?: "active" | "suspended" | "pending_verification";
|
|
3310
3396
|
email?: string;
|
|
3311
3397
|
}
|
|
3398
|
+
/**
|
|
3399
|
+
* Response shape of `GET /sites/{siteName}/users/me`. Extends V2SiteUser with
|
|
3400
|
+
* a `profile` side-channel populated from the `site_user_profiles` KV table.
|
|
3401
|
+
*/
|
|
3402
|
+
interface V2SiteUserWithProfile extends V2SiteUser {
|
|
3403
|
+
profile: Record<string, unknown>;
|
|
3404
|
+
}
|
|
3405
|
+
/**
|
|
3406
|
+
* Standalone profile envelope returned by
|
|
3407
|
+
* `GET|PUT /sites/{siteName}/users/me/profile[/:key]`. Each `data` entry is a
|
|
3408
|
+
* parsed value (arbitrary JSON).
|
|
3409
|
+
*/
|
|
3410
|
+
interface V2SiteUserProfile {
|
|
3411
|
+
object: "site_user_profile";
|
|
3412
|
+
site_user_id: string;
|
|
3413
|
+
data: Record<string, unknown>;
|
|
3414
|
+
}
|
|
3312
3415
|
interface V2NewsletterSubscription extends V2Object {
|
|
3313
3416
|
object: "newsletter_subscription";
|
|
3314
3417
|
email: string;
|
|
@@ -3355,6 +3458,75 @@ interface V2NewsletterCampaign extends V2Object {
|
|
|
3355
3458
|
interface V2NewsletterTrackingResponse {
|
|
3356
3459
|
success: boolean;
|
|
3357
3460
|
}
|
|
3461
|
+
interface V2NewsletterListCreateParams {
|
|
3462
|
+
list_name: string;
|
|
3463
|
+
slug: string;
|
|
3464
|
+
description?: string | null;
|
|
3465
|
+
is_public?: boolean;
|
|
3466
|
+
is_default?: boolean;
|
|
3467
|
+
welcome_email_enabled?: boolean;
|
|
3468
|
+
}
|
|
3469
|
+
interface V2NewsletterListUpdateParams {
|
|
3470
|
+
list_name?: string;
|
|
3471
|
+
slug?: string;
|
|
3472
|
+
description?: string | null;
|
|
3473
|
+
is_public?: boolean;
|
|
3474
|
+
is_default?: boolean;
|
|
3475
|
+
welcome_email_enabled?: boolean;
|
|
3476
|
+
status?: "active" | "archived";
|
|
3477
|
+
}
|
|
3478
|
+
interface V2NewsletterSyncInput {
|
|
3479
|
+
email: string;
|
|
3480
|
+
name?: string | null;
|
|
3481
|
+
status?: "pending" | "confirmed" | "unsubscribed" | "bounced" | "complained";
|
|
3482
|
+
list_ids?: string[];
|
|
3483
|
+
frequency?: "instant" | "daily" | "weekly" | "monthly";
|
|
3484
|
+
topics?: string[];
|
|
3485
|
+
language?: string | null;
|
|
3486
|
+
source?: string | null;
|
|
3487
|
+
source_url?: string | null;
|
|
3488
|
+
notes?: string | null;
|
|
3489
|
+
tags?: string[];
|
|
3490
|
+
metadata?: Record<string, unknown>;
|
|
3491
|
+
resubscribe_override?: boolean;
|
|
3492
|
+
}
|
|
3493
|
+
interface V2NewsletterSyncResult {
|
|
3494
|
+
object: "newsletter_sync_result";
|
|
3495
|
+
applied: boolean;
|
|
3496
|
+
code: "CREATED" | "UPDATED" | "RESUBSCRIBED" | "ALREADY_UNSUBSCRIBED";
|
|
3497
|
+
skipped_unsubscribed: boolean;
|
|
3498
|
+
resubscribed: boolean;
|
|
3499
|
+
created: boolean;
|
|
3500
|
+
updated: boolean;
|
|
3501
|
+
subscription: Record<string, unknown>;
|
|
3502
|
+
}
|
|
3503
|
+
interface V2NewsletterSubscriptionListMembershipUpdate {
|
|
3504
|
+
mode: "add" | "remove" | "replace";
|
|
3505
|
+
list_ids: string[];
|
|
3506
|
+
}
|
|
3507
|
+
interface V2NewsletterImportRequest {
|
|
3508
|
+
rows: V2NewsletterSyncInput[];
|
|
3509
|
+
resubscribe_override?: boolean;
|
|
3510
|
+
}
|
|
3511
|
+
interface V2NewsletterImportResult {
|
|
3512
|
+
object: "newsletter_import_result";
|
|
3513
|
+
total: number;
|
|
3514
|
+
processed: number;
|
|
3515
|
+
applied: number;
|
|
3516
|
+
created: number;
|
|
3517
|
+
updated: number;
|
|
3518
|
+
resubscribed: number;
|
|
3519
|
+
skipped_unsubscribed: number;
|
|
3520
|
+
rows: Array<{
|
|
3521
|
+
index: number;
|
|
3522
|
+
email: string;
|
|
3523
|
+
applied: boolean;
|
|
3524
|
+
code: V2NewsletterSyncResult["code"];
|
|
3525
|
+
skipped_unsubscribed: boolean;
|
|
3526
|
+
resubscribed: boolean;
|
|
3527
|
+
subscription_id: string;
|
|
3528
|
+
}>;
|
|
3529
|
+
}
|
|
3358
3530
|
interface V2ContactSubmission extends V2Object {
|
|
3359
3531
|
object: "contact_submission";
|
|
3360
3532
|
name: string | null;
|
|
@@ -3462,6 +3634,8 @@ declare abstract class BaseV2Client {
|
|
|
3462
3634
|
protected post<T>(path: string, body?: unknown): Promise<T>;
|
|
3463
3635
|
/** PATCH to update a resource. */
|
|
3464
3636
|
protected patchOne<T>(path: string, body?: unknown): Promise<T>;
|
|
3637
|
+
/** PUT to upsert a resource. */
|
|
3638
|
+
protected putOne<T>(path: string, body?: unknown): Promise<T>;
|
|
3465
3639
|
/** DELETE a resource. */
|
|
3466
3640
|
protected deleteOne(path: string): Promise<V2Deleted>;
|
|
3467
3641
|
/** Fetch with optional cache. Bypasses cache for writes or when no cache is configured. */
|
|
@@ -3488,13 +3662,18 @@ declare abstract class BaseV2Client {
|
|
|
3488
3662
|
|
|
3489
3663
|
declare class ContentV2Client extends BaseV2Client {
|
|
3490
3664
|
list(siteName: string, params?: V2ContentListParams, cachePolicy?: CachePolicy): Promise<V2List<V2Content>>;
|
|
3491
|
-
listAutoPaginated(siteName: string, params?: Omit<V2ContentListParams, 'starting_after' | 'ending_before'
|
|
3665
|
+
listAutoPaginated(siteName: string, params?: Omit<V2ContentListParams, 'starting_after' | 'ending_before'>, cachePolicy?: CachePolicy): AsyncGenerator<V2Content, void, unknown>;
|
|
3492
3666
|
get(siteName: string, idOrSlug: string, cachePolicy?: CachePolicy): Promise<V2Content>;
|
|
3493
3667
|
create(siteName: string, data: V2ContentCreateParams): Promise<V2Content>;
|
|
3494
3668
|
update(siteName: string, id: string, data: V2ContentUpdateParams): Promise<V2Content>;
|
|
3495
3669
|
del(siteName: string, id: string): Promise<V2Deleted>;
|
|
3496
3670
|
publish(siteName: string, id: string): Promise<V2Content>;
|
|
3497
3671
|
unpublish(siteName: string, id: string): Promise<V2Content>;
|
|
3672
|
+
private withContentTags;
|
|
3673
|
+
private buildContentTags;
|
|
3674
|
+
private normalizeTagPart;
|
|
3675
|
+
private extractSlugPrefix;
|
|
3676
|
+
private isContentId;
|
|
3498
3677
|
}
|
|
3499
3678
|
|
|
3500
3679
|
/**
|
|
@@ -3546,16 +3725,33 @@ declare class CollectionsV2Client extends BaseV2Client {
|
|
|
3546
3725
|
|
|
3547
3726
|
/**
|
|
3548
3727
|
* v2 Orders Client (checkout sessions)
|
|
3728
|
+
*
|
|
3729
|
+
* `create()` initiates a Stripe checkout session and returns the checkout URL.
|
|
3730
|
+
* No CSRF token is needed — v2 uses API-key auth only.
|
|
3549
3731
|
*/
|
|
3550
3732
|
|
|
3551
3733
|
declare class OrdersV2Client extends BaseV2Client {
|
|
3552
3734
|
list(siteName: string, params?: V2OrderListParams, cachePolicy?: CachePolicy): Promise<V2List<V2Order>>;
|
|
3553
3735
|
listAutoPaginated(siteName: string, params?: Omit<V2OrderListParams, 'starting_after' | 'ending_before'>): AsyncGenerator<V2Order, void, unknown>;
|
|
3554
3736
|
get(siteName: string, id: string, cachePolicy?: CachePolicy): Promise<V2Order>;
|
|
3737
|
+
/**
|
|
3738
|
+
* Create a checkout session via Stripe. Returns the session ID and a
|
|
3739
|
+
* `checkout_url` that the client should redirect to (or open in a new tab).
|
|
3740
|
+
*
|
|
3741
|
+
* This replaces the v1 `checkout.createCheckoutSession()` + `getCsrfToken()`
|
|
3742
|
+
* dance — v2 is API-key-only and requires no CSRF token.
|
|
3743
|
+
*/
|
|
3744
|
+
create(siteName: string, data: V2OrderCreateParams): Promise<V2OrderCreateResult>;
|
|
3555
3745
|
}
|
|
3556
3746
|
|
|
3557
3747
|
/**
|
|
3558
3748
|
* v2 Site Users Client
|
|
3749
|
+
*
|
|
3750
|
+
* Two classes of endpoints:
|
|
3751
|
+
* - Admin paths (list/get/update/OTP flows) require an API key. Use the
|
|
3752
|
+
* usual `setApiKey(...)` on the main `PerspectApiV2Client` before calling.
|
|
3753
|
+
* - `/me*` paths require a site-user JWT (minted by `verifyOtp`). Call
|
|
3754
|
+
* `setAuth(jwt)` on the main client before calling these.
|
|
3559
3755
|
*/
|
|
3560
3756
|
|
|
3561
3757
|
interface V2OtpRequestResponse {
|
|
@@ -3580,6 +3776,23 @@ declare class SiteUsersV2Client extends BaseV2Client {
|
|
|
3580
3776
|
listAutoPaginated(siteName: string, params?: Omit<V2SiteUserListParams, 'starting_after' | 'ending_before'>): AsyncGenerator<V2SiteUser, void, unknown>;
|
|
3581
3777
|
get(siteName: string, id: string): Promise<V2SiteUser>;
|
|
3582
3778
|
update(siteName: string, id: string, data: V2SiteUserUpdateParams): Promise<V2SiteUser>;
|
|
3779
|
+
/**
|
|
3780
|
+
* Load the currently-authenticated site user's canonical record plus their
|
|
3781
|
+
* profile KV map. Requires `client.setAuth(jwt)` to have been called with
|
|
3782
|
+
* the token returned from `verifyOtp`.
|
|
3783
|
+
*/
|
|
3784
|
+
getMe(siteName: string): Promise<V2SiteUserWithProfile>;
|
|
3785
|
+
/** Update the authenticated user's own fields. */
|
|
3786
|
+
updateMe(siteName: string, data: V2SiteUserMeUpdateParams): Promise<V2SiteUser>;
|
|
3787
|
+
/** Fetch the profile KV map as a dedicated `site_user_profile` envelope. */
|
|
3788
|
+
getProfile(siteName: string): Promise<V2SiteUserProfile>;
|
|
3789
|
+
/**
|
|
3790
|
+
* Set a single profile key. The value is persisted verbatim — callers wanting
|
|
3791
|
+
* structured data should JSON-stringify their value first.
|
|
3792
|
+
*/
|
|
3793
|
+
setProfileValue(siteName: string, key: string, value: string): Promise<V2SiteUserProfile>;
|
|
3794
|
+
/** Delete a single profile key. */
|
|
3795
|
+
deleteProfileValue(siteName: string, key: string): Promise<V2Deleted>;
|
|
3583
3796
|
}
|
|
3584
3797
|
|
|
3585
3798
|
/**
|
|
@@ -3615,6 +3828,26 @@ declare class NewsletterV2Client extends BaseV2Client {
|
|
|
3615
3828
|
status?: string;
|
|
3616
3829
|
}, cachePolicy?: CachePolicy): Promise<V2List<V2NewsletterCampaign>>;
|
|
3617
3830
|
getCampaign(siteName: string, idOrSlug: string, cachePolicy?: CachePolicy): Promise<V2NewsletterCampaign>;
|
|
3831
|
+
createList(siteName: string, data: V2NewsletterListCreateParams): Promise<V2NewsletterList>;
|
|
3832
|
+
updateList(siteName: string, id: string, data: V2NewsletterListUpdateParams): Promise<V2NewsletterList>;
|
|
3833
|
+
deleteList(siteName: string, id: string): Promise<V2Deleted>;
|
|
3834
|
+
/**
|
|
3835
|
+
* Upsert a subscription by email and (optionally) replace its list
|
|
3836
|
+
* memberships. Returns a `newsletter_sync_result` envelope with the
|
|
3837
|
+
* outcome (created / updated / resubscribed / already-unsubscribed).
|
|
3838
|
+
*/
|
|
3839
|
+
syncSubscription(siteName: string, data: V2NewsletterSyncInput): Promise<V2NewsletterSyncResult>;
|
|
3840
|
+
/**
|
|
3841
|
+
* Add/remove/replace the list memberships for an existing subscription.
|
|
3842
|
+
* Returns the refreshed subscription record.
|
|
3843
|
+
*/
|
|
3844
|
+
updateSubscriptionListMembership(siteName: string, subscriptionId: string, data: V2NewsletterSubscriptionListMembershipUpdate): Promise<V2NewsletterSubscription>;
|
|
3845
|
+
/**
|
|
3846
|
+
* Bulk import subscriptions. Each row is upserted via the same sync
|
|
3847
|
+
* path; `refreshListCounts` is deferred until after all rows are
|
|
3848
|
+
* processed on the server.
|
|
3849
|
+
*/
|
|
3850
|
+
importSubscriptions(siteName: string, data: V2NewsletterImportRequest): Promise<V2NewsletterImportResult>;
|
|
3618
3851
|
}
|
|
3619
3852
|
|
|
3620
3853
|
/**
|
|
@@ -4075,4 +4308,4 @@ declare function createCheckoutSession(options: CheckoutSessionOptions): Promise
|
|
|
4075
4308
|
error: string;
|
|
4076
4309
|
}>;
|
|
4077
4310
|
|
|
4078
|
-
export { type AddCollectionItemRequest, type ApiError, type ApiKey, ApiKeysClient, type ApiResponse, AuthClient, BaseClient, type BlogPost, type BundleCollection, type BundleCollectionItem, type BundleCollectionItemWithProduct, BundlesClient, type CacheConfig, CacheManager, type CancelSubscriptionRequest, type CancelSubscriptionResponse, 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, CloudflareKVCacheAdapter, 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 CreateProductSkuRequest, type CreateSiteRequest, type CreateWebhookRequest, type CreditBalance, type CreditBalanceWithTransactions, type CreditTransaction, DEFAULT_IMAGE_SIZES, type GrantCreditRequest, HttpClient, type HttpMethod, type ImageTransformOptions, InMemoryCacheAdapter, type LoadContentBySlugOptions, type LoadContentOptions, type LoadProductBySlugOptions, type LoadProductsOptions, type LoaderLogger, type LoaderOptions, type MediaItem, type NewsletterCampaignDetail, type NewsletterCampaignListResponse, type NewsletterCampaignSummary, type NewsletterCampaignTestSendRequest, type NewsletterCampaignTestSendResponse, NewsletterClient, type NewsletterConfirmResponse, type NewsletterExportCreateRequest, type NewsletterExportCreateResponse, type NewsletterList, type NewsletterManagementCampaign, type NewsletterManagementCampaignListResponse, NewsletterManagementClient, type NewsletterManagementList, type NewsletterManagementListMembership, type NewsletterManagementPagination, type NewsletterManagementSeries, type NewsletterManagementStatsResponse, type NewsletterManagementSubscription, type NewsletterManagementSubscriptionsListResponse, type NewsletterPreferences, type NewsletterStatusResponse, type NewsletterSubscribeResponse, type NewsletterSubscription, type NewsletterSubscriptionImportRowRequest, type NewsletterSubscriptionMembershipUpdateRequest, type NewsletterSubscriptionSyncRequest, type NewsletterSubscriptionSyncResponse, type NewsletterSubscriptionsBulkAction, type NewsletterSubscriptionsBulkOutcome, type NewsletterSubscriptionsBulkUpdateRequest, type NewsletterSubscriptionsBulkUpdateResponse, type NewsletterSubscriptionsImportRequest, type NewsletterSubscriptionsImportResponse, type NewsletterSubscriptionsImportRowResult, type NewsletterUnsubscribeRequest, type NewsletterUnsubscribeResponse, NoopCacheAdapter, type Organization, OrganizationsClient, type PaginatedResponse, type PaginationParams, type PaymentGateway, PerspectApiClient, type PerspectApiConfig, PerspectApiV2Client, PerspectV2Error, type Product, type ProductBundleGroup, type ProductQueryParams, type ProductSku, type ProductSkuMediaItem, type ProductSkuOption, ProductsClient, type RequestOptions, type RequestOtpRequest, type ResponsiveImageSizes, type SetProfileValueRequest, type Site, type SiteUser, type SiteUserOrder, type SiteUserProfile, type SiteUserSubscription, SiteUsersClient, SitesClient, type SubscriptionCancellationMode, type UpdateApiKeyRequest, type UpdateContentRequest, type UpdateSiteUserRequest, type User, type VerifyOtpRequest, type VerifyOtpResponse, type Webhook, WebhooksClient, buildImageUrl, createApiError, createCheckoutSession, createPerspectApiClient, createPerspectApiV2Client, PerspectApiClient as default, generateResponsiveImageHtml, generateResponsiveUrls, generateSizesAttribute, generateSrcSet, loadAllContent, loadContentBySlug, loadPages, loadPosts, loadProductBySlug, loadProducts, transformContent, transformMediaItem, transformProduct };
|
|
4311
|
+
export { type AddCollectionItemRequest, type ApiError, type ApiKey, ApiKeysClient, type ApiResponse, AuthClient, BaseClient, type BlogPost, type BundleCollection, type BundleCollectionItem, type BundleCollectionItemWithProduct, BundlesClient, type CacheConfig, CacheManager, type CancelSubscriptionRequest, type CancelSubscriptionResponse, 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, CloudflareKVCacheAdapter, 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 CreateProductSkuRequest, type CreateSiteRequest, type CreateWebhookRequest, type CreditBalance, type CreditBalanceWithTransactions, type CreditTransaction, DEFAULT_IMAGE_SIZES, type GrantCreditRequest, HttpClient, type HttpMethod, type ImageTransformOptions, InMemoryCacheAdapter, type LoadContentBySlugOptions, type LoadContentOptions, type LoadProductBySlugOptions, type LoadProductsOptions, type LoaderLogger, type LoaderOptions, type MediaItem, type NewsletterCampaignDetail, type NewsletterCampaignListResponse, type NewsletterCampaignSummary, type NewsletterCampaignTestSendRequest, type NewsletterCampaignTestSendResponse, NewsletterClient, type NewsletterConfirmResponse, type NewsletterExportCreateRequest, type NewsletterExportCreateResponse, type NewsletterList, type NewsletterManagementCampaign, type NewsletterManagementCampaignListResponse, NewsletterManagementClient, type NewsletterManagementList, type NewsletterManagementListMembership, type NewsletterManagementPagination, type NewsletterManagementSeries, type NewsletterManagementStatsResponse, type NewsletterManagementSubscription, type NewsletterManagementSubscriptionsListResponse, type NewsletterPreferences, type NewsletterStatusResponse, type NewsletterSubscribeResponse, type NewsletterSubscription, type NewsletterSubscriptionImportRowRequest, type NewsletterSubscriptionMembershipUpdateRequest, type NewsletterSubscriptionSyncRequest, type NewsletterSubscriptionSyncResponse, type NewsletterSubscriptionsBulkAction, type NewsletterSubscriptionsBulkOutcome, type NewsletterSubscriptionsBulkUpdateRequest, type NewsletterSubscriptionsBulkUpdateResponse, type NewsletterSubscriptionsImportRequest, type NewsletterSubscriptionsImportResponse, type NewsletterSubscriptionsImportRowResult, type NewsletterUnsubscribeRequest, type NewsletterUnsubscribeResponse, NoopCacheAdapter, type Organization, OrganizationsClient, type PaginatedResponse, type PaginationParams, type PaymentGateway, PerspectApiClient, type PerspectApiConfig, PerspectApiV2Client, PerspectV2Error, type Product, type ProductBundleGroup, type ProductQueryParams, type ProductSku, type ProductSkuMediaItem, type ProductSkuOption, ProductsClient, type RequestOptions, type RequestOtpRequest, type ResponsiveImageSizes, type SetProfileValueRequest, type Site, type SiteUser, type SiteUserOrder, type SiteUserProfile, type SiteUserSubscription, SiteUsersClient, SitesClient, type SubscriptionCancellationMode, type UpdateApiKeyRequest, type UpdateContentRequest, type UpdateSiteUserRequest, type User, type V2ApiKey, type V2Category, type V2CategoryCreateParams, type V2CategoryUpdateParams, type V2Collection, type V2CollectionCreateParams, type V2CollectionItem, type V2CollectionUpdateParams, type V2ContactSubmission, type V2Content, type V2ContentCreateParams, type V2ContentListParams, type V2ContentUpdateParams, type V2Deleted, type V2Error, type V2ErrorType, type V2List, type V2Media, type V2NewsletterCampaign, type V2NewsletterImportRequest, type V2NewsletterImportResult, type V2NewsletterList, type V2NewsletterListCreateParams, type V2NewsletterListUpdateParams, type V2NewsletterSubscription, type V2NewsletterSubscriptionListMembershipUpdate, type V2NewsletterSyncInput, type V2NewsletterSyncResult, type V2NewsletterTrackingResponse, type V2Object, type V2Order, type V2OrderAddress, type V2OrderCreateParams, type V2OrderCreateResult, type V2OrderLineItem, type V2OrderLineItemPriceData, type V2OrderListParams, type V2OrderTaxRequest, type V2Organization, type V2PaginationParams, type V2Product, type V2ProductCreateParams, type V2ProductListParams, type V2ProductUpdateParams, type V2Site, type V2SiteUser, type V2SiteUserListParams, type V2SiteUserMeUpdateParams, type V2SiteUserProfile, type V2SiteUserUpdateParams, type V2SiteUserWithProfile, type V2Webhook, type V2WebhookCreateParams, type V2WebhookUpdateParams, type VerifyOtpRequest, type VerifyOtpResponse, type Webhook, WebhooksClient, buildImageUrl, createApiError, createCheckoutSession, createPerspectApiClient, createPerspectApiV2Client, PerspectApiClient as default, generateResponsiveImageHtml, generateResponsiveUrls, generateSizesAttribute, generateSrcSet, loadAllContent, loadContentBySlug, loadPages, loadPosts, loadProductBySlug, loadProducts, transformContent, transformMediaItem, transformProduct };
|
package/dist/index.d.ts
CHANGED
|
@@ -3284,6 +3284,82 @@ interface V2OrderListParams extends V2PaginationParams {
|
|
|
3284
3284
|
date_from?: string;
|
|
3285
3285
|
date_to?: string;
|
|
3286
3286
|
}
|
|
3287
|
+
interface V2OrderLineItemPriceData {
|
|
3288
|
+
currency: string;
|
|
3289
|
+
product_data: {
|
|
3290
|
+
name: string;
|
|
3291
|
+
description?: string;
|
|
3292
|
+
images?: string[];
|
|
3293
|
+
};
|
|
3294
|
+
unit_amount: number;
|
|
3295
|
+
}
|
|
3296
|
+
interface V2OrderLineItem {
|
|
3297
|
+
sku_id?: number;
|
|
3298
|
+
product_id?: number;
|
|
3299
|
+
price_data?: V2OrderLineItemPriceData;
|
|
3300
|
+
price?: string;
|
|
3301
|
+
quantity: number;
|
|
3302
|
+
}
|
|
3303
|
+
interface V2OrderAddress {
|
|
3304
|
+
line1?: string;
|
|
3305
|
+
line2?: string;
|
|
3306
|
+
city?: string;
|
|
3307
|
+
state?: string;
|
|
3308
|
+
postal_code?: string;
|
|
3309
|
+
country?: string;
|
|
3310
|
+
}
|
|
3311
|
+
interface V2OrderTaxRequest {
|
|
3312
|
+
strategy?: string;
|
|
3313
|
+
customer_identifier?: string;
|
|
3314
|
+
customer_profile_id?: string;
|
|
3315
|
+
customer_display_name?: string;
|
|
3316
|
+
allow_exemption?: boolean;
|
|
3317
|
+
save_profile?: boolean;
|
|
3318
|
+
customer_exemption?: {
|
|
3319
|
+
status?: "none" | "exempt" | "reverse_charge";
|
|
3320
|
+
reason?: string;
|
|
3321
|
+
tax_id?: string;
|
|
3322
|
+
tax_id_type?: string;
|
|
3323
|
+
certificate_url?: string;
|
|
3324
|
+
metadata?: Record<string, unknown>;
|
|
3325
|
+
expires_at?: string;
|
|
3326
|
+
};
|
|
3327
|
+
}
|
|
3328
|
+
interface V2OrderCreateParams {
|
|
3329
|
+
line_items: V2OrderLineItem[];
|
|
3330
|
+
success_url: string;
|
|
3331
|
+
cancel_url: string;
|
|
3332
|
+
customer_email?: string;
|
|
3333
|
+
site_user_id?: string;
|
|
3334
|
+
mode?: "payment" | "subscription";
|
|
3335
|
+
metadata?: Record<string, string | number | boolean>;
|
|
3336
|
+
tax?: V2OrderTaxRequest;
|
|
3337
|
+
shipping_amount?: number;
|
|
3338
|
+
shipping_address?: V2OrderAddress;
|
|
3339
|
+
billing_address?: V2OrderAddress;
|
|
3340
|
+
currency?: string;
|
|
3341
|
+
referral_code?: string;
|
|
3342
|
+
referrer_site_user_id?: string;
|
|
3343
|
+
}
|
|
3344
|
+
interface V2OrderCreateResult extends V2Object {
|
|
3345
|
+
object: "checkout_session";
|
|
3346
|
+
checkout_url: string | null;
|
|
3347
|
+
payment_status: string | null;
|
|
3348
|
+
tax: {
|
|
3349
|
+
amount: number;
|
|
3350
|
+
currency: string;
|
|
3351
|
+
strategy: string;
|
|
3352
|
+
exemption_applied: boolean;
|
|
3353
|
+
exemption_status: string;
|
|
3354
|
+
breakdown: Array<{
|
|
3355
|
+
jurisdiction?: string;
|
|
3356
|
+
rate_percent: number;
|
|
3357
|
+
tax_amount: number;
|
|
3358
|
+
taxable_amount: number;
|
|
3359
|
+
source: string;
|
|
3360
|
+
}>;
|
|
3361
|
+
};
|
|
3362
|
+
}
|
|
3287
3363
|
interface V2SiteUser extends V2Object {
|
|
3288
3364
|
object: "site_user";
|
|
3289
3365
|
email: string;
|
|
@@ -3305,10 +3381,37 @@ interface V2SiteUserUpdateParams {
|
|
|
3305
3381
|
status?: "active" | "suspended" | "pending_verification";
|
|
3306
3382
|
metadata?: Record<string, unknown>;
|
|
3307
3383
|
}
|
|
3384
|
+
/**
|
|
3385
|
+
* Patch shape for the authenticated `/me` endpoint. Unlike the admin update,
|
|
3386
|
+
* end users cannot change their own `status`.
|
|
3387
|
+
*/
|
|
3388
|
+
interface V2SiteUserMeUpdateParams {
|
|
3389
|
+
first_name?: string;
|
|
3390
|
+
last_name?: string;
|
|
3391
|
+
avatar_url?: string;
|
|
3392
|
+
metadata?: Record<string, unknown>;
|
|
3393
|
+
}
|
|
3308
3394
|
interface V2SiteUserListParams extends V2PaginationParams {
|
|
3309
3395
|
status?: "active" | "suspended" | "pending_verification";
|
|
3310
3396
|
email?: string;
|
|
3311
3397
|
}
|
|
3398
|
+
/**
|
|
3399
|
+
* Response shape of `GET /sites/{siteName}/users/me`. Extends V2SiteUser with
|
|
3400
|
+
* a `profile` side-channel populated from the `site_user_profiles` KV table.
|
|
3401
|
+
*/
|
|
3402
|
+
interface V2SiteUserWithProfile extends V2SiteUser {
|
|
3403
|
+
profile: Record<string, unknown>;
|
|
3404
|
+
}
|
|
3405
|
+
/**
|
|
3406
|
+
* Standalone profile envelope returned by
|
|
3407
|
+
* `GET|PUT /sites/{siteName}/users/me/profile[/:key]`. Each `data` entry is a
|
|
3408
|
+
* parsed value (arbitrary JSON).
|
|
3409
|
+
*/
|
|
3410
|
+
interface V2SiteUserProfile {
|
|
3411
|
+
object: "site_user_profile";
|
|
3412
|
+
site_user_id: string;
|
|
3413
|
+
data: Record<string, unknown>;
|
|
3414
|
+
}
|
|
3312
3415
|
interface V2NewsletterSubscription extends V2Object {
|
|
3313
3416
|
object: "newsletter_subscription";
|
|
3314
3417
|
email: string;
|
|
@@ -3355,6 +3458,75 @@ interface V2NewsletterCampaign extends V2Object {
|
|
|
3355
3458
|
interface V2NewsletterTrackingResponse {
|
|
3356
3459
|
success: boolean;
|
|
3357
3460
|
}
|
|
3461
|
+
interface V2NewsletterListCreateParams {
|
|
3462
|
+
list_name: string;
|
|
3463
|
+
slug: string;
|
|
3464
|
+
description?: string | null;
|
|
3465
|
+
is_public?: boolean;
|
|
3466
|
+
is_default?: boolean;
|
|
3467
|
+
welcome_email_enabled?: boolean;
|
|
3468
|
+
}
|
|
3469
|
+
interface V2NewsletterListUpdateParams {
|
|
3470
|
+
list_name?: string;
|
|
3471
|
+
slug?: string;
|
|
3472
|
+
description?: string | null;
|
|
3473
|
+
is_public?: boolean;
|
|
3474
|
+
is_default?: boolean;
|
|
3475
|
+
welcome_email_enabled?: boolean;
|
|
3476
|
+
status?: "active" | "archived";
|
|
3477
|
+
}
|
|
3478
|
+
interface V2NewsletterSyncInput {
|
|
3479
|
+
email: string;
|
|
3480
|
+
name?: string | null;
|
|
3481
|
+
status?: "pending" | "confirmed" | "unsubscribed" | "bounced" | "complained";
|
|
3482
|
+
list_ids?: string[];
|
|
3483
|
+
frequency?: "instant" | "daily" | "weekly" | "monthly";
|
|
3484
|
+
topics?: string[];
|
|
3485
|
+
language?: string | null;
|
|
3486
|
+
source?: string | null;
|
|
3487
|
+
source_url?: string | null;
|
|
3488
|
+
notes?: string | null;
|
|
3489
|
+
tags?: string[];
|
|
3490
|
+
metadata?: Record<string, unknown>;
|
|
3491
|
+
resubscribe_override?: boolean;
|
|
3492
|
+
}
|
|
3493
|
+
interface V2NewsletterSyncResult {
|
|
3494
|
+
object: "newsletter_sync_result";
|
|
3495
|
+
applied: boolean;
|
|
3496
|
+
code: "CREATED" | "UPDATED" | "RESUBSCRIBED" | "ALREADY_UNSUBSCRIBED";
|
|
3497
|
+
skipped_unsubscribed: boolean;
|
|
3498
|
+
resubscribed: boolean;
|
|
3499
|
+
created: boolean;
|
|
3500
|
+
updated: boolean;
|
|
3501
|
+
subscription: Record<string, unknown>;
|
|
3502
|
+
}
|
|
3503
|
+
interface V2NewsletterSubscriptionListMembershipUpdate {
|
|
3504
|
+
mode: "add" | "remove" | "replace";
|
|
3505
|
+
list_ids: string[];
|
|
3506
|
+
}
|
|
3507
|
+
interface V2NewsletterImportRequest {
|
|
3508
|
+
rows: V2NewsletterSyncInput[];
|
|
3509
|
+
resubscribe_override?: boolean;
|
|
3510
|
+
}
|
|
3511
|
+
interface V2NewsletterImportResult {
|
|
3512
|
+
object: "newsletter_import_result";
|
|
3513
|
+
total: number;
|
|
3514
|
+
processed: number;
|
|
3515
|
+
applied: number;
|
|
3516
|
+
created: number;
|
|
3517
|
+
updated: number;
|
|
3518
|
+
resubscribed: number;
|
|
3519
|
+
skipped_unsubscribed: number;
|
|
3520
|
+
rows: Array<{
|
|
3521
|
+
index: number;
|
|
3522
|
+
email: string;
|
|
3523
|
+
applied: boolean;
|
|
3524
|
+
code: V2NewsletterSyncResult["code"];
|
|
3525
|
+
skipped_unsubscribed: boolean;
|
|
3526
|
+
resubscribed: boolean;
|
|
3527
|
+
subscription_id: string;
|
|
3528
|
+
}>;
|
|
3529
|
+
}
|
|
3358
3530
|
interface V2ContactSubmission extends V2Object {
|
|
3359
3531
|
object: "contact_submission";
|
|
3360
3532
|
name: string | null;
|
|
@@ -3462,6 +3634,8 @@ declare abstract class BaseV2Client {
|
|
|
3462
3634
|
protected post<T>(path: string, body?: unknown): Promise<T>;
|
|
3463
3635
|
/** PATCH to update a resource. */
|
|
3464
3636
|
protected patchOne<T>(path: string, body?: unknown): Promise<T>;
|
|
3637
|
+
/** PUT to upsert a resource. */
|
|
3638
|
+
protected putOne<T>(path: string, body?: unknown): Promise<T>;
|
|
3465
3639
|
/** DELETE a resource. */
|
|
3466
3640
|
protected deleteOne(path: string): Promise<V2Deleted>;
|
|
3467
3641
|
/** Fetch with optional cache. Bypasses cache for writes or when no cache is configured. */
|
|
@@ -3488,13 +3662,18 @@ declare abstract class BaseV2Client {
|
|
|
3488
3662
|
|
|
3489
3663
|
declare class ContentV2Client extends BaseV2Client {
|
|
3490
3664
|
list(siteName: string, params?: V2ContentListParams, cachePolicy?: CachePolicy): Promise<V2List<V2Content>>;
|
|
3491
|
-
listAutoPaginated(siteName: string, params?: Omit<V2ContentListParams, 'starting_after' | 'ending_before'
|
|
3665
|
+
listAutoPaginated(siteName: string, params?: Omit<V2ContentListParams, 'starting_after' | 'ending_before'>, cachePolicy?: CachePolicy): AsyncGenerator<V2Content, void, unknown>;
|
|
3492
3666
|
get(siteName: string, idOrSlug: string, cachePolicy?: CachePolicy): Promise<V2Content>;
|
|
3493
3667
|
create(siteName: string, data: V2ContentCreateParams): Promise<V2Content>;
|
|
3494
3668
|
update(siteName: string, id: string, data: V2ContentUpdateParams): Promise<V2Content>;
|
|
3495
3669
|
del(siteName: string, id: string): Promise<V2Deleted>;
|
|
3496
3670
|
publish(siteName: string, id: string): Promise<V2Content>;
|
|
3497
3671
|
unpublish(siteName: string, id: string): Promise<V2Content>;
|
|
3672
|
+
private withContentTags;
|
|
3673
|
+
private buildContentTags;
|
|
3674
|
+
private normalizeTagPart;
|
|
3675
|
+
private extractSlugPrefix;
|
|
3676
|
+
private isContentId;
|
|
3498
3677
|
}
|
|
3499
3678
|
|
|
3500
3679
|
/**
|
|
@@ -3546,16 +3725,33 @@ declare class CollectionsV2Client extends BaseV2Client {
|
|
|
3546
3725
|
|
|
3547
3726
|
/**
|
|
3548
3727
|
* v2 Orders Client (checkout sessions)
|
|
3728
|
+
*
|
|
3729
|
+
* `create()` initiates a Stripe checkout session and returns the checkout URL.
|
|
3730
|
+
* No CSRF token is needed — v2 uses API-key auth only.
|
|
3549
3731
|
*/
|
|
3550
3732
|
|
|
3551
3733
|
declare class OrdersV2Client extends BaseV2Client {
|
|
3552
3734
|
list(siteName: string, params?: V2OrderListParams, cachePolicy?: CachePolicy): Promise<V2List<V2Order>>;
|
|
3553
3735
|
listAutoPaginated(siteName: string, params?: Omit<V2OrderListParams, 'starting_after' | 'ending_before'>): AsyncGenerator<V2Order, void, unknown>;
|
|
3554
3736
|
get(siteName: string, id: string, cachePolicy?: CachePolicy): Promise<V2Order>;
|
|
3737
|
+
/**
|
|
3738
|
+
* Create a checkout session via Stripe. Returns the session ID and a
|
|
3739
|
+
* `checkout_url` that the client should redirect to (or open in a new tab).
|
|
3740
|
+
*
|
|
3741
|
+
* This replaces the v1 `checkout.createCheckoutSession()` + `getCsrfToken()`
|
|
3742
|
+
* dance — v2 is API-key-only and requires no CSRF token.
|
|
3743
|
+
*/
|
|
3744
|
+
create(siteName: string, data: V2OrderCreateParams): Promise<V2OrderCreateResult>;
|
|
3555
3745
|
}
|
|
3556
3746
|
|
|
3557
3747
|
/**
|
|
3558
3748
|
* v2 Site Users Client
|
|
3749
|
+
*
|
|
3750
|
+
* Two classes of endpoints:
|
|
3751
|
+
* - Admin paths (list/get/update/OTP flows) require an API key. Use the
|
|
3752
|
+
* usual `setApiKey(...)` on the main `PerspectApiV2Client` before calling.
|
|
3753
|
+
* - `/me*` paths require a site-user JWT (minted by `verifyOtp`). Call
|
|
3754
|
+
* `setAuth(jwt)` on the main client before calling these.
|
|
3559
3755
|
*/
|
|
3560
3756
|
|
|
3561
3757
|
interface V2OtpRequestResponse {
|
|
@@ -3580,6 +3776,23 @@ declare class SiteUsersV2Client extends BaseV2Client {
|
|
|
3580
3776
|
listAutoPaginated(siteName: string, params?: Omit<V2SiteUserListParams, 'starting_after' | 'ending_before'>): AsyncGenerator<V2SiteUser, void, unknown>;
|
|
3581
3777
|
get(siteName: string, id: string): Promise<V2SiteUser>;
|
|
3582
3778
|
update(siteName: string, id: string, data: V2SiteUserUpdateParams): Promise<V2SiteUser>;
|
|
3779
|
+
/**
|
|
3780
|
+
* Load the currently-authenticated site user's canonical record plus their
|
|
3781
|
+
* profile KV map. Requires `client.setAuth(jwt)` to have been called with
|
|
3782
|
+
* the token returned from `verifyOtp`.
|
|
3783
|
+
*/
|
|
3784
|
+
getMe(siteName: string): Promise<V2SiteUserWithProfile>;
|
|
3785
|
+
/** Update the authenticated user's own fields. */
|
|
3786
|
+
updateMe(siteName: string, data: V2SiteUserMeUpdateParams): Promise<V2SiteUser>;
|
|
3787
|
+
/** Fetch the profile KV map as a dedicated `site_user_profile` envelope. */
|
|
3788
|
+
getProfile(siteName: string): Promise<V2SiteUserProfile>;
|
|
3789
|
+
/**
|
|
3790
|
+
* Set a single profile key. The value is persisted verbatim — callers wanting
|
|
3791
|
+
* structured data should JSON-stringify their value first.
|
|
3792
|
+
*/
|
|
3793
|
+
setProfileValue(siteName: string, key: string, value: string): Promise<V2SiteUserProfile>;
|
|
3794
|
+
/** Delete a single profile key. */
|
|
3795
|
+
deleteProfileValue(siteName: string, key: string): Promise<V2Deleted>;
|
|
3583
3796
|
}
|
|
3584
3797
|
|
|
3585
3798
|
/**
|
|
@@ -3615,6 +3828,26 @@ declare class NewsletterV2Client extends BaseV2Client {
|
|
|
3615
3828
|
status?: string;
|
|
3616
3829
|
}, cachePolicy?: CachePolicy): Promise<V2List<V2NewsletterCampaign>>;
|
|
3617
3830
|
getCampaign(siteName: string, idOrSlug: string, cachePolicy?: CachePolicy): Promise<V2NewsletterCampaign>;
|
|
3831
|
+
createList(siteName: string, data: V2NewsletterListCreateParams): Promise<V2NewsletterList>;
|
|
3832
|
+
updateList(siteName: string, id: string, data: V2NewsletterListUpdateParams): Promise<V2NewsletterList>;
|
|
3833
|
+
deleteList(siteName: string, id: string): Promise<V2Deleted>;
|
|
3834
|
+
/**
|
|
3835
|
+
* Upsert a subscription by email and (optionally) replace its list
|
|
3836
|
+
* memberships. Returns a `newsletter_sync_result` envelope with the
|
|
3837
|
+
* outcome (created / updated / resubscribed / already-unsubscribed).
|
|
3838
|
+
*/
|
|
3839
|
+
syncSubscription(siteName: string, data: V2NewsletterSyncInput): Promise<V2NewsletterSyncResult>;
|
|
3840
|
+
/**
|
|
3841
|
+
* Add/remove/replace the list memberships for an existing subscription.
|
|
3842
|
+
* Returns the refreshed subscription record.
|
|
3843
|
+
*/
|
|
3844
|
+
updateSubscriptionListMembership(siteName: string, subscriptionId: string, data: V2NewsletterSubscriptionListMembershipUpdate): Promise<V2NewsletterSubscription>;
|
|
3845
|
+
/**
|
|
3846
|
+
* Bulk import subscriptions. Each row is upserted via the same sync
|
|
3847
|
+
* path; `refreshListCounts` is deferred until after all rows are
|
|
3848
|
+
* processed on the server.
|
|
3849
|
+
*/
|
|
3850
|
+
importSubscriptions(siteName: string, data: V2NewsletterImportRequest): Promise<V2NewsletterImportResult>;
|
|
3618
3851
|
}
|
|
3619
3852
|
|
|
3620
3853
|
/**
|
|
@@ -4075,4 +4308,4 @@ declare function createCheckoutSession(options: CheckoutSessionOptions): Promise
|
|
|
4075
4308
|
error: string;
|
|
4076
4309
|
}>;
|
|
4077
4310
|
|
|
4078
|
-
export { type AddCollectionItemRequest, type ApiError, type ApiKey, ApiKeysClient, type ApiResponse, AuthClient, BaseClient, type BlogPost, type BundleCollection, type BundleCollectionItem, type BundleCollectionItemWithProduct, BundlesClient, type CacheConfig, CacheManager, type CancelSubscriptionRequest, type CancelSubscriptionResponse, 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, CloudflareKVCacheAdapter, 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 CreateProductSkuRequest, type CreateSiteRequest, type CreateWebhookRequest, type CreditBalance, type CreditBalanceWithTransactions, type CreditTransaction, DEFAULT_IMAGE_SIZES, type GrantCreditRequest, HttpClient, type HttpMethod, type ImageTransformOptions, InMemoryCacheAdapter, type LoadContentBySlugOptions, type LoadContentOptions, type LoadProductBySlugOptions, type LoadProductsOptions, type LoaderLogger, type LoaderOptions, type MediaItem, type NewsletterCampaignDetail, type NewsletterCampaignListResponse, type NewsletterCampaignSummary, type NewsletterCampaignTestSendRequest, type NewsletterCampaignTestSendResponse, NewsletterClient, type NewsletterConfirmResponse, type NewsletterExportCreateRequest, type NewsletterExportCreateResponse, type NewsletterList, type NewsletterManagementCampaign, type NewsletterManagementCampaignListResponse, NewsletterManagementClient, type NewsletterManagementList, type NewsletterManagementListMembership, type NewsletterManagementPagination, type NewsletterManagementSeries, type NewsletterManagementStatsResponse, type NewsletterManagementSubscription, type NewsletterManagementSubscriptionsListResponse, type NewsletterPreferences, type NewsletterStatusResponse, type NewsletterSubscribeResponse, type NewsletterSubscription, type NewsletterSubscriptionImportRowRequest, type NewsletterSubscriptionMembershipUpdateRequest, type NewsletterSubscriptionSyncRequest, type NewsletterSubscriptionSyncResponse, type NewsletterSubscriptionsBulkAction, type NewsletterSubscriptionsBulkOutcome, type NewsletterSubscriptionsBulkUpdateRequest, type NewsletterSubscriptionsBulkUpdateResponse, type NewsletterSubscriptionsImportRequest, type NewsletterSubscriptionsImportResponse, type NewsletterSubscriptionsImportRowResult, type NewsletterUnsubscribeRequest, type NewsletterUnsubscribeResponse, NoopCacheAdapter, type Organization, OrganizationsClient, type PaginatedResponse, type PaginationParams, type PaymentGateway, PerspectApiClient, type PerspectApiConfig, PerspectApiV2Client, PerspectV2Error, type Product, type ProductBundleGroup, type ProductQueryParams, type ProductSku, type ProductSkuMediaItem, type ProductSkuOption, ProductsClient, type RequestOptions, type RequestOtpRequest, type ResponsiveImageSizes, type SetProfileValueRequest, type Site, type SiteUser, type SiteUserOrder, type SiteUserProfile, type SiteUserSubscription, SiteUsersClient, SitesClient, type SubscriptionCancellationMode, type UpdateApiKeyRequest, type UpdateContentRequest, type UpdateSiteUserRequest, type User, type VerifyOtpRequest, type VerifyOtpResponse, type Webhook, WebhooksClient, buildImageUrl, createApiError, createCheckoutSession, createPerspectApiClient, createPerspectApiV2Client, PerspectApiClient as default, generateResponsiveImageHtml, generateResponsiveUrls, generateSizesAttribute, generateSrcSet, loadAllContent, loadContentBySlug, loadPages, loadPosts, loadProductBySlug, loadProducts, transformContent, transformMediaItem, transformProduct };
|
|
4311
|
+
export { type AddCollectionItemRequest, type ApiError, type ApiKey, ApiKeysClient, type ApiResponse, AuthClient, BaseClient, type BlogPost, type BundleCollection, type BundleCollectionItem, type BundleCollectionItemWithProduct, BundlesClient, type CacheConfig, CacheManager, type CancelSubscriptionRequest, type CancelSubscriptionResponse, 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, CloudflareKVCacheAdapter, 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 CreateProductSkuRequest, type CreateSiteRequest, type CreateWebhookRequest, type CreditBalance, type CreditBalanceWithTransactions, type CreditTransaction, DEFAULT_IMAGE_SIZES, type GrantCreditRequest, HttpClient, type HttpMethod, type ImageTransformOptions, InMemoryCacheAdapter, type LoadContentBySlugOptions, type LoadContentOptions, type LoadProductBySlugOptions, type LoadProductsOptions, type LoaderLogger, type LoaderOptions, type MediaItem, type NewsletterCampaignDetail, type NewsletterCampaignListResponse, type NewsletterCampaignSummary, type NewsletterCampaignTestSendRequest, type NewsletterCampaignTestSendResponse, NewsletterClient, type NewsletterConfirmResponse, type NewsletterExportCreateRequest, type NewsletterExportCreateResponse, type NewsletterList, type NewsletterManagementCampaign, type NewsletterManagementCampaignListResponse, NewsletterManagementClient, type NewsletterManagementList, type NewsletterManagementListMembership, type NewsletterManagementPagination, type NewsletterManagementSeries, type NewsletterManagementStatsResponse, type NewsletterManagementSubscription, type NewsletterManagementSubscriptionsListResponse, type NewsletterPreferences, type NewsletterStatusResponse, type NewsletterSubscribeResponse, type NewsletterSubscription, type NewsletterSubscriptionImportRowRequest, type NewsletterSubscriptionMembershipUpdateRequest, type NewsletterSubscriptionSyncRequest, type NewsletterSubscriptionSyncResponse, type NewsletterSubscriptionsBulkAction, type NewsletterSubscriptionsBulkOutcome, type NewsletterSubscriptionsBulkUpdateRequest, type NewsletterSubscriptionsBulkUpdateResponse, type NewsletterSubscriptionsImportRequest, type NewsletterSubscriptionsImportResponse, type NewsletterSubscriptionsImportRowResult, type NewsletterUnsubscribeRequest, type NewsletterUnsubscribeResponse, NoopCacheAdapter, type Organization, OrganizationsClient, type PaginatedResponse, type PaginationParams, type PaymentGateway, PerspectApiClient, type PerspectApiConfig, PerspectApiV2Client, PerspectV2Error, type Product, type ProductBundleGroup, type ProductQueryParams, type ProductSku, type ProductSkuMediaItem, type ProductSkuOption, ProductsClient, type RequestOptions, type RequestOtpRequest, type ResponsiveImageSizes, type SetProfileValueRequest, type Site, type SiteUser, type SiteUserOrder, type SiteUserProfile, type SiteUserSubscription, SiteUsersClient, SitesClient, type SubscriptionCancellationMode, type UpdateApiKeyRequest, type UpdateContentRequest, type UpdateSiteUserRequest, type User, type V2ApiKey, type V2Category, type V2CategoryCreateParams, type V2CategoryUpdateParams, type V2Collection, type V2CollectionCreateParams, type V2CollectionItem, type V2CollectionUpdateParams, type V2ContactSubmission, type V2Content, type V2ContentCreateParams, type V2ContentListParams, type V2ContentUpdateParams, type V2Deleted, type V2Error, type V2ErrorType, type V2List, type V2Media, type V2NewsletterCampaign, type V2NewsletterImportRequest, type V2NewsletterImportResult, type V2NewsletterList, type V2NewsletterListCreateParams, type V2NewsletterListUpdateParams, type V2NewsletterSubscription, type V2NewsletterSubscriptionListMembershipUpdate, type V2NewsletterSyncInput, type V2NewsletterSyncResult, type V2NewsletterTrackingResponse, type V2Object, type V2Order, type V2OrderAddress, type V2OrderCreateParams, type V2OrderCreateResult, type V2OrderLineItem, type V2OrderLineItemPriceData, type V2OrderListParams, type V2OrderTaxRequest, type V2Organization, type V2PaginationParams, type V2Product, type V2ProductCreateParams, type V2ProductListParams, type V2ProductUpdateParams, type V2Site, type V2SiteUser, type V2SiteUserListParams, type V2SiteUserMeUpdateParams, type V2SiteUserProfile, type V2SiteUserUpdateParams, type V2SiteUserWithProfile, type V2Webhook, type V2WebhookCreateParams, type V2WebhookUpdateParams, type VerifyOtpRequest, type VerifyOtpResponse, type Webhook, WebhooksClient, buildImageUrl, createApiError, createCheckoutSession, createPerspectApiClient, createPerspectApiV2Client, PerspectApiClient as default, generateResponsiveImageHtml, generateResponsiveUrls, generateSizesAttribute, generateSrcSet, loadAllContent, loadContentBySlug, loadPages, loadPosts, loadProductBySlug, loadProducts, transformContent, transformMediaItem, transformProduct };
|