perspectapi-ts-sdk 5.4.4 → 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 +237 -2
- package/dist/index.d.ts +237 -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 +194 -0
package/dist/index.d.mts
CHANGED
|
@@ -3112,6 +3112,8 @@ interface V2Media extends V2Object {
|
|
|
3112
3112
|
width: number | null;
|
|
3113
3113
|
height: number | null;
|
|
3114
3114
|
filesize: number | null;
|
|
3115
|
+
caption: string | null;
|
|
3116
|
+
alt_text: string | null;
|
|
3115
3117
|
}
|
|
3116
3118
|
interface V2Content extends V2Object {
|
|
3117
3119
|
object: "content";
|
|
@@ -3282,6 +3284,82 @@ interface V2OrderListParams extends V2PaginationParams {
|
|
|
3282
3284
|
date_from?: string;
|
|
3283
3285
|
date_to?: string;
|
|
3284
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
|
+
}
|
|
3285
3363
|
interface V2SiteUser extends V2Object {
|
|
3286
3364
|
object: "site_user";
|
|
3287
3365
|
email: string;
|
|
@@ -3303,10 +3381,37 @@ interface V2SiteUserUpdateParams {
|
|
|
3303
3381
|
status?: "active" | "suspended" | "pending_verification";
|
|
3304
3382
|
metadata?: Record<string, unknown>;
|
|
3305
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
|
+
}
|
|
3306
3394
|
interface V2SiteUserListParams extends V2PaginationParams {
|
|
3307
3395
|
status?: "active" | "suspended" | "pending_verification";
|
|
3308
3396
|
email?: string;
|
|
3309
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
|
+
}
|
|
3310
3415
|
interface V2NewsletterSubscription extends V2Object {
|
|
3311
3416
|
object: "newsletter_subscription";
|
|
3312
3417
|
email: string;
|
|
@@ -3353,6 +3458,75 @@ interface V2NewsletterCampaign extends V2Object {
|
|
|
3353
3458
|
interface V2NewsletterTrackingResponse {
|
|
3354
3459
|
success: boolean;
|
|
3355
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
|
+
}
|
|
3356
3530
|
interface V2ContactSubmission extends V2Object {
|
|
3357
3531
|
object: "contact_submission";
|
|
3358
3532
|
name: string | null;
|
|
@@ -3460,6 +3634,8 @@ declare abstract class BaseV2Client {
|
|
|
3460
3634
|
protected post<T>(path: string, body?: unknown): Promise<T>;
|
|
3461
3635
|
/** PATCH to update a resource. */
|
|
3462
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>;
|
|
3463
3639
|
/** DELETE a resource. */
|
|
3464
3640
|
protected deleteOne(path: string): Promise<V2Deleted>;
|
|
3465
3641
|
/** Fetch with optional cache. Bypasses cache for writes or when no cache is configured. */
|
|
@@ -3486,13 +3662,18 @@ declare abstract class BaseV2Client {
|
|
|
3486
3662
|
|
|
3487
3663
|
declare class ContentV2Client extends BaseV2Client {
|
|
3488
3664
|
list(siteName: string, params?: V2ContentListParams, cachePolicy?: CachePolicy): Promise<V2List<V2Content>>;
|
|
3489
|
-
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>;
|
|
3490
3666
|
get(siteName: string, idOrSlug: string, cachePolicy?: CachePolicy): Promise<V2Content>;
|
|
3491
3667
|
create(siteName: string, data: V2ContentCreateParams): Promise<V2Content>;
|
|
3492
3668
|
update(siteName: string, id: string, data: V2ContentUpdateParams): Promise<V2Content>;
|
|
3493
3669
|
del(siteName: string, id: string): Promise<V2Deleted>;
|
|
3494
3670
|
publish(siteName: string, id: string): Promise<V2Content>;
|
|
3495
3671
|
unpublish(siteName: string, id: string): Promise<V2Content>;
|
|
3672
|
+
private withContentTags;
|
|
3673
|
+
private buildContentTags;
|
|
3674
|
+
private normalizeTagPart;
|
|
3675
|
+
private extractSlugPrefix;
|
|
3676
|
+
private isContentId;
|
|
3496
3677
|
}
|
|
3497
3678
|
|
|
3498
3679
|
/**
|
|
@@ -3544,16 +3725,33 @@ declare class CollectionsV2Client extends BaseV2Client {
|
|
|
3544
3725
|
|
|
3545
3726
|
/**
|
|
3546
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.
|
|
3547
3731
|
*/
|
|
3548
3732
|
|
|
3549
3733
|
declare class OrdersV2Client extends BaseV2Client {
|
|
3550
3734
|
list(siteName: string, params?: V2OrderListParams, cachePolicy?: CachePolicy): Promise<V2List<V2Order>>;
|
|
3551
3735
|
listAutoPaginated(siteName: string, params?: Omit<V2OrderListParams, 'starting_after' | 'ending_before'>): AsyncGenerator<V2Order, void, unknown>;
|
|
3552
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>;
|
|
3553
3745
|
}
|
|
3554
3746
|
|
|
3555
3747
|
/**
|
|
3556
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.
|
|
3557
3755
|
*/
|
|
3558
3756
|
|
|
3559
3757
|
interface V2OtpRequestResponse {
|
|
@@ -3578,6 +3776,23 @@ declare class SiteUsersV2Client extends BaseV2Client {
|
|
|
3578
3776
|
listAutoPaginated(siteName: string, params?: Omit<V2SiteUserListParams, 'starting_after' | 'ending_before'>): AsyncGenerator<V2SiteUser, void, unknown>;
|
|
3579
3777
|
get(siteName: string, id: string): Promise<V2SiteUser>;
|
|
3580
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>;
|
|
3581
3796
|
}
|
|
3582
3797
|
|
|
3583
3798
|
/**
|
|
@@ -3613,6 +3828,26 @@ declare class NewsletterV2Client extends BaseV2Client {
|
|
|
3613
3828
|
status?: string;
|
|
3614
3829
|
}, cachePolicy?: CachePolicy): Promise<V2List<V2NewsletterCampaign>>;
|
|
3615
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>;
|
|
3616
3851
|
}
|
|
3617
3852
|
|
|
3618
3853
|
/**
|
|
@@ -4073,4 +4308,4 @@ declare function createCheckoutSession(options: CheckoutSessionOptions): Promise
|
|
|
4073
4308
|
error: string;
|
|
4074
4309
|
}>;
|
|
4075
4310
|
|
|
4076
|
-
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
|
@@ -3112,6 +3112,8 @@ interface V2Media extends V2Object {
|
|
|
3112
3112
|
width: number | null;
|
|
3113
3113
|
height: number | null;
|
|
3114
3114
|
filesize: number | null;
|
|
3115
|
+
caption: string | null;
|
|
3116
|
+
alt_text: string | null;
|
|
3115
3117
|
}
|
|
3116
3118
|
interface V2Content extends V2Object {
|
|
3117
3119
|
object: "content";
|
|
@@ -3282,6 +3284,82 @@ interface V2OrderListParams extends V2PaginationParams {
|
|
|
3282
3284
|
date_from?: string;
|
|
3283
3285
|
date_to?: string;
|
|
3284
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
|
+
}
|
|
3285
3363
|
interface V2SiteUser extends V2Object {
|
|
3286
3364
|
object: "site_user";
|
|
3287
3365
|
email: string;
|
|
@@ -3303,10 +3381,37 @@ interface V2SiteUserUpdateParams {
|
|
|
3303
3381
|
status?: "active" | "suspended" | "pending_verification";
|
|
3304
3382
|
metadata?: Record<string, unknown>;
|
|
3305
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
|
+
}
|
|
3306
3394
|
interface V2SiteUserListParams extends V2PaginationParams {
|
|
3307
3395
|
status?: "active" | "suspended" | "pending_verification";
|
|
3308
3396
|
email?: string;
|
|
3309
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
|
+
}
|
|
3310
3415
|
interface V2NewsletterSubscription extends V2Object {
|
|
3311
3416
|
object: "newsletter_subscription";
|
|
3312
3417
|
email: string;
|
|
@@ -3353,6 +3458,75 @@ interface V2NewsletterCampaign extends V2Object {
|
|
|
3353
3458
|
interface V2NewsletterTrackingResponse {
|
|
3354
3459
|
success: boolean;
|
|
3355
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
|
+
}
|
|
3356
3530
|
interface V2ContactSubmission extends V2Object {
|
|
3357
3531
|
object: "contact_submission";
|
|
3358
3532
|
name: string | null;
|
|
@@ -3460,6 +3634,8 @@ declare abstract class BaseV2Client {
|
|
|
3460
3634
|
protected post<T>(path: string, body?: unknown): Promise<T>;
|
|
3461
3635
|
/** PATCH to update a resource. */
|
|
3462
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>;
|
|
3463
3639
|
/** DELETE a resource. */
|
|
3464
3640
|
protected deleteOne(path: string): Promise<V2Deleted>;
|
|
3465
3641
|
/** Fetch with optional cache. Bypasses cache for writes or when no cache is configured. */
|
|
@@ -3486,13 +3662,18 @@ declare abstract class BaseV2Client {
|
|
|
3486
3662
|
|
|
3487
3663
|
declare class ContentV2Client extends BaseV2Client {
|
|
3488
3664
|
list(siteName: string, params?: V2ContentListParams, cachePolicy?: CachePolicy): Promise<V2List<V2Content>>;
|
|
3489
|
-
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>;
|
|
3490
3666
|
get(siteName: string, idOrSlug: string, cachePolicy?: CachePolicy): Promise<V2Content>;
|
|
3491
3667
|
create(siteName: string, data: V2ContentCreateParams): Promise<V2Content>;
|
|
3492
3668
|
update(siteName: string, id: string, data: V2ContentUpdateParams): Promise<V2Content>;
|
|
3493
3669
|
del(siteName: string, id: string): Promise<V2Deleted>;
|
|
3494
3670
|
publish(siteName: string, id: string): Promise<V2Content>;
|
|
3495
3671
|
unpublish(siteName: string, id: string): Promise<V2Content>;
|
|
3672
|
+
private withContentTags;
|
|
3673
|
+
private buildContentTags;
|
|
3674
|
+
private normalizeTagPart;
|
|
3675
|
+
private extractSlugPrefix;
|
|
3676
|
+
private isContentId;
|
|
3496
3677
|
}
|
|
3497
3678
|
|
|
3498
3679
|
/**
|
|
@@ -3544,16 +3725,33 @@ declare class CollectionsV2Client extends BaseV2Client {
|
|
|
3544
3725
|
|
|
3545
3726
|
/**
|
|
3546
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.
|
|
3547
3731
|
*/
|
|
3548
3732
|
|
|
3549
3733
|
declare class OrdersV2Client extends BaseV2Client {
|
|
3550
3734
|
list(siteName: string, params?: V2OrderListParams, cachePolicy?: CachePolicy): Promise<V2List<V2Order>>;
|
|
3551
3735
|
listAutoPaginated(siteName: string, params?: Omit<V2OrderListParams, 'starting_after' | 'ending_before'>): AsyncGenerator<V2Order, void, unknown>;
|
|
3552
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>;
|
|
3553
3745
|
}
|
|
3554
3746
|
|
|
3555
3747
|
/**
|
|
3556
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.
|
|
3557
3755
|
*/
|
|
3558
3756
|
|
|
3559
3757
|
interface V2OtpRequestResponse {
|
|
@@ -3578,6 +3776,23 @@ declare class SiteUsersV2Client extends BaseV2Client {
|
|
|
3578
3776
|
listAutoPaginated(siteName: string, params?: Omit<V2SiteUserListParams, 'starting_after' | 'ending_before'>): AsyncGenerator<V2SiteUser, void, unknown>;
|
|
3579
3777
|
get(siteName: string, id: string): Promise<V2SiteUser>;
|
|
3580
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>;
|
|
3581
3796
|
}
|
|
3582
3797
|
|
|
3583
3798
|
/**
|
|
@@ -3613,6 +3828,26 @@ declare class NewsletterV2Client extends BaseV2Client {
|
|
|
3613
3828
|
status?: string;
|
|
3614
3829
|
}, cachePolicy?: CachePolicy): Promise<V2List<V2NewsletterCampaign>>;
|
|
3615
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>;
|
|
3616
3851
|
}
|
|
3617
3852
|
|
|
3618
3853
|
/**
|
|
@@ -4073,4 +4308,4 @@ declare function createCheckoutSession(options: CheckoutSessionOptions): Promise
|
|
|
4073
4308
|
error: string;
|
|
4074
4309
|
}>;
|
|
4075
4310
|
|
|
4076
|
-
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 };
|