perspectapi-ts-sdk 3.6.0 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -58
- package/dist/index.d.mts +457 -170
- package/dist/index.d.ts +457 -170
- package/dist/index.js +209 -107
- package/dist/index.mjs +208 -107
- package/package.json +1 -1
- package/src/client/newsletter-client.ts +0 -242
- package/src/client/newsletter-management-client.ts +426 -0
- package/src/client/products-client.ts +59 -27
- package/src/index.ts +25 -0
- package/src/perspect-api-client.ts +3 -0
- package/src/types/index.ts +322 -0
package/dist/index.d.ts
CHANGED
|
@@ -277,6 +277,239 @@ interface NewsletterUnsubscribeResponse {
|
|
|
277
277
|
message: string;
|
|
278
278
|
status?: string;
|
|
279
279
|
}
|
|
280
|
+
interface NewsletterManagementListMembership {
|
|
281
|
+
id: string;
|
|
282
|
+
list_name: string;
|
|
283
|
+
slug: string;
|
|
284
|
+
}
|
|
285
|
+
interface NewsletterManagementSubscription {
|
|
286
|
+
id: string;
|
|
287
|
+
site_id: string;
|
|
288
|
+
site_name: string;
|
|
289
|
+
email: string;
|
|
290
|
+
name?: string | null;
|
|
291
|
+
status: 'pending' | 'confirmed' | 'unsubscribed' | 'bounced' | 'complained';
|
|
292
|
+
confirmation_token?: string | null;
|
|
293
|
+
unsubscribe_token: string;
|
|
294
|
+
double_opt_in: boolean;
|
|
295
|
+
confirmed_at?: string | null;
|
|
296
|
+
source?: string | null;
|
|
297
|
+
source_url?: string | null;
|
|
298
|
+
frequency: 'instant' | 'daily' | 'weekly' | 'monthly';
|
|
299
|
+
topics?: string[] | string | null;
|
|
300
|
+
language: string;
|
|
301
|
+
tags?: string[] | string | null;
|
|
302
|
+
custom_fields?: Record<string, any> | string | null;
|
|
303
|
+
notes?: string | null;
|
|
304
|
+
unsubscribed_at?: string | null;
|
|
305
|
+
unsubscribe_reason?: string | null;
|
|
306
|
+
created_at: string;
|
|
307
|
+
updated_at: string;
|
|
308
|
+
lists: NewsletterManagementListMembership[];
|
|
309
|
+
}
|
|
310
|
+
interface NewsletterSubscriptionSyncRequest {
|
|
311
|
+
email: string;
|
|
312
|
+
name?: string | null;
|
|
313
|
+
status?: 'pending' | 'confirmed' | 'unsubscribed' | 'bounced' | 'complained';
|
|
314
|
+
list_ids?: string[];
|
|
315
|
+
frequency?: 'instant' | 'daily' | 'weekly' | 'monthly';
|
|
316
|
+
topics?: string[];
|
|
317
|
+
language?: string | null;
|
|
318
|
+
source?: string | null;
|
|
319
|
+
source_url?: string | null;
|
|
320
|
+
notes?: string | null;
|
|
321
|
+
tags?: string[];
|
|
322
|
+
metadata?: Record<string, any>;
|
|
323
|
+
resubscribe_override?: boolean;
|
|
324
|
+
}
|
|
325
|
+
interface NewsletterSubscriptionSyncResponse {
|
|
326
|
+
applied: boolean;
|
|
327
|
+
code: 'CREATED' | 'UPDATED' | 'RESUBSCRIBED' | 'ALREADY_UNSUBSCRIBED';
|
|
328
|
+
skipped_unsubscribed: boolean;
|
|
329
|
+
resubscribed: boolean;
|
|
330
|
+
created: boolean;
|
|
331
|
+
updated: boolean;
|
|
332
|
+
subscription_id: string;
|
|
333
|
+
subscription: NewsletterManagementSubscription;
|
|
334
|
+
}
|
|
335
|
+
type NewsletterSubscriptionsBulkAction = 'confirm' | 'unsubscribe' | 'delete' | 'add_to_list' | 'remove_from_list';
|
|
336
|
+
interface NewsletterSubscriptionsBulkUpdateRequest {
|
|
337
|
+
ids: string[];
|
|
338
|
+
action: NewsletterSubscriptionsBulkAction;
|
|
339
|
+
list_id?: string;
|
|
340
|
+
resubscribe_override?: boolean;
|
|
341
|
+
}
|
|
342
|
+
interface NewsletterSubscriptionsBulkOutcome {
|
|
343
|
+
id: string;
|
|
344
|
+
applied: boolean;
|
|
345
|
+
code: string;
|
|
346
|
+
error?: string;
|
|
347
|
+
skipped_unsubscribed?: boolean;
|
|
348
|
+
}
|
|
349
|
+
interface NewsletterSubscriptionsBulkUpdateResponse {
|
|
350
|
+
succeeded: number;
|
|
351
|
+
failed: number;
|
|
352
|
+
skipped_unsubscribed: number;
|
|
353
|
+
outcomes: NewsletterSubscriptionsBulkOutcome[];
|
|
354
|
+
}
|
|
355
|
+
interface NewsletterSubscriptionMembershipUpdateRequest {
|
|
356
|
+
mode: 'add' | 'remove' | 'replace';
|
|
357
|
+
list_ids: string[];
|
|
358
|
+
}
|
|
359
|
+
interface NewsletterSubscriptionImportRowRequest {
|
|
360
|
+
email: string;
|
|
361
|
+
name?: string | null;
|
|
362
|
+
status?: 'pending' | 'confirmed' | 'unsubscribed' | 'bounced' | 'complained';
|
|
363
|
+
list_ids?: string[];
|
|
364
|
+
frequency?: 'instant' | 'daily' | 'weekly' | 'monthly';
|
|
365
|
+
topics?: string[];
|
|
366
|
+
language?: string | null;
|
|
367
|
+
source?: string | null;
|
|
368
|
+
source_url?: string | null;
|
|
369
|
+
notes?: string | null;
|
|
370
|
+
tags?: string[];
|
|
371
|
+
metadata?: Record<string, any>;
|
|
372
|
+
resubscribe_override?: boolean;
|
|
373
|
+
}
|
|
374
|
+
interface NewsletterSubscriptionsImportRequest {
|
|
375
|
+
rows: NewsletterSubscriptionImportRowRequest[];
|
|
376
|
+
resubscribe_override?: boolean;
|
|
377
|
+
}
|
|
378
|
+
interface NewsletterSubscriptionsImportRowResult {
|
|
379
|
+
index: number;
|
|
380
|
+
email: string;
|
|
381
|
+
applied: boolean;
|
|
382
|
+
code: string;
|
|
383
|
+
skipped_unsubscribed: boolean;
|
|
384
|
+
resubscribed: boolean;
|
|
385
|
+
subscription_id: string;
|
|
386
|
+
}
|
|
387
|
+
interface NewsletterSubscriptionsImportResponse {
|
|
388
|
+
total: number;
|
|
389
|
+
processed: number;
|
|
390
|
+
applied: number;
|
|
391
|
+
created: number;
|
|
392
|
+
updated: number;
|
|
393
|
+
resubscribed: number;
|
|
394
|
+
skipped_unsubscribed: number;
|
|
395
|
+
rows: NewsletterSubscriptionsImportRowResult[];
|
|
396
|
+
}
|
|
397
|
+
interface NewsletterManagementPagination {
|
|
398
|
+
page: number;
|
|
399
|
+
limit: number;
|
|
400
|
+
total: number;
|
|
401
|
+
pages: number;
|
|
402
|
+
}
|
|
403
|
+
interface NewsletterManagementSubscriptionsListResponse {
|
|
404
|
+
items: NewsletterManagementSubscription[];
|
|
405
|
+
pagination: NewsletterManagementPagination;
|
|
406
|
+
}
|
|
407
|
+
interface NewsletterManagementList extends NewsletterList {
|
|
408
|
+
site_id: string;
|
|
409
|
+
site_name: string;
|
|
410
|
+
description?: string;
|
|
411
|
+
is_public: boolean;
|
|
412
|
+
is_default: boolean;
|
|
413
|
+
double_opt_in: boolean;
|
|
414
|
+
welcome_email_enabled: boolean;
|
|
415
|
+
subscriber_count: number;
|
|
416
|
+
status: 'active' | 'archived';
|
|
417
|
+
created_at: string;
|
|
418
|
+
updated_at: string;
|
|
419
|
+
}
|
|
420
|
+
interface NewsletterManagementSeries {
|
|
421
|
+
id: string;
|
|
422
|
+
site_id: string;
|
|
423
|
+
site_name: string;
|
|
424
|
+
series_name: string;
|
|
425
|
+
description?: string | null;
|
|
426
|
+
list_ids?: string | null;
|
|
427
|
+
from_name?: string | null;
|
|
428
|
+
from_email?: string | null;
|
|
429
|
+
reply_to_email?: string | null;
|
|
430
|
+
subject_prefix?: string | null;
|
|
431
|
+
cadence: 'manual' | 'daily' | 'weekly' | 'monthly';
|
|
432
|
+
timezone?: string | null;
|
|
433
|
+
send_time?: string | null;
|
|
434
|
+
day_of_week?: number | null;
|
|
435
|
+
day_of_month?: number | null;
|
|
436
|
+
status: 'active' | 'paused' | 'archived';
|
|
437
|
+
last_sent_at?: string | null;
|
|
438
|
+
next_send_at?: string | null;
|
|
439
|
+
tags?: string | null;
|
|
440
|
+
notes?: string | null;
|
|
441
|
+
created_at: string;
|
|
442
|
+
updated_at: string;
|
|
443
|
+
created_by?: string | null;
|
|
444
|
+
}
|
|
445
|
+
interface NewsletterManagementCampaign {
|
|
446
|
+
id: string;
|
|
447
|
+
site_id: string;
|
|
448
|
+
site_name: string;
|
|
449
|
+
series_id?: string | null;
|
|
450
|
+
series_name?: string | null;
|
|
451
|
+
campaign_name: string;
|
|
452
|
+
slug?: string | null;
|
|
453
|
+
slug_prefix?: string | null;
|
|
454
|
+
subject: string;
|
|
455
|
+
markdown_content?: string | null;
|
|
456
|
+
template_id?: string | null;
|
|
457
|
+
list_ids?: string | null;
|
|
458
|
+
tags?: string | null;
|
|
459
|
+
notes?: string | null;
|
|
460
|
+
preview_text?: string | null;
|
|
461
|
+
from_name?: string | null;
|
|
462
|
+
from_email?: string | null;
|
|
463
|
+
reply_to_email?: string | null;
|
|
464
|
+
status: 'draft' | 'scheduled' | 'sending' | 'sent' | 'cancelled';
|
|
465
|
+
scheduled_at?: string | null;
|
|
466
|
+
sent_at?: string | null;
|
|
467
|
+
completed_at?: string | null;
|
|
468
|
+
total_recipients?: number | null;
|
|
469
|
+
sent_count?: number | null;
|
|
470
|
+
delivered_count?: number | null;
|
|
471
|
+
opened_count?: number | null;
|
|
472
|
+
clicked_count?: number | null;
|
|
473
|
+
unsubscribed_count?: number | null;
|
|
474
|
+
bounced_count?: number | null;
|
|
475
|
+
complained_count?: number | null;
|
|
476
|
+
created_at: string;
|
|
477
|
+
updated_at: string;
|
|
478
|
+
}
|
|
479
|
+
interface NewsletterManagementCampaignListResponse {
|
|
480
|
+
items: NewsletterManagementCampaign[];
|
|
481
|
+
pagination: NewsletterManagementPagination;
|
|
482
|
+
}
|
|
483
|
+
interface NewsletterCampaignTestSendRequest {
|
|
484
|
+
to: string | string[];
|
|
485
|
+
subject?: string | null;
|
|
486
|
+
}
|
|
487
|
+
interface NewsletterCampaignTestSendResponse {
|
|
488
|
+
sent: number;
|
|
489
|
+
recipients: string[];
|
|
490
|
+
campaign_id: string;
|
|
491
|
+
}
|
|
492
|
+
interface NewsletterManagementStatsResponse {
|
|
493
|
+
total: number;
|
|
494
|
+
byStatus: Record<string, number>;
|
|
495
|
+
recentActivity: Array<{
|
|
496
|
+
date: string;
|
|
497
|
+
count: number;
|
|
498
|
+
}>;
|
|
499
|
+
}
|
|
500
|
+
interface NewsletterExportCreateRequest {
|
|
501
|
+
format?: 'csv' | 'json' | 'xlsx';
|
|
502
|
+
status?: 'pending' | 'confirmed' | 'unsubscribed' | 'bounced' | 'complained';
|
|
503
|
+
list_id?: string;
|
|
504
|
+
search?: string | null;
|
|
505
|
+
}
|
|
506
|
+
interface NewsletterExportCreateResponse {
|
|
507
|
+
exportId: string;
|
|
508
|
+
downloadUrl: string;
|
|
509
|
+
expiresAt: string;
|
|
510
|
+
format: 'csv' | 'json';
|
|
511
|
+
rowCount: number;
|
|
512
|
+
}
|
|
280
513
|
type ContentStatus = 'draft' | 'publish' | 'private' | 'trash';
|
|
281
514
|
type ContentType = 'post' | 'page' | 'block';
|
|
282
515
|
interface Content {
|
|
@@ -359,6 +592,46 @@ interface MediaItem {
|
|
|
359
592
|
r2_key: string;
|
|
360
593
|
site_name: string;
|
|
361
594
|
}
|
|
595
|
+
interface ProductSkuMediaItem {
|
|
596
|
+
id?: string;
|
|
597
|
+
media_id: string;
|
|
598
|
+
file_name?: string;
|
|
599
|
+
fileName?: string;
|
|
600
|
+
link?: string;
|
|
601
|
+
url?: string;
|
|
602
|
+
content_type?: string;
|
|
603
|
+
contentType?: string;
|
|
604
|
+
width?: number;
|
|
605
|
+
height?: number;
|
|
606
|
+
filesize?: number;
|
|
607
|
+
r2_key?: string;
|
|
608
|
+
site_name?: string;
|
|
609
|
+
}
|
|
610
|
+
interface ProductSkuOption {
|
|
611
|
+
name: string;
|
|
612
|
+
key: string;
|
|
613
|
+
value: string;
|
|
614
|
+
label: string;
|
|
615
|
+
value_id: number;
|
|
616
|
+
}
|
|
617
|
+
interface ProductSku {
|
|
618
|
+
sku_id: number;
|
|
619
|
+
sku?: string | null;
|
|
620
|
+
combination_key: string;
|
|
621
|
+
media_id?: string | null;
|
|
622
|
+
media?: ProductSkuMediaItem | null;
|
|
623
|
+
options?: ProductSkuOption[];
|
|
624
|
+
unit_amount?: number;
|
|
625
|
+
currency?: string;
|
|
626
|
+
quantity_available?: number | null;
|
|
627
|
+
price?: number;
|
|
628
|
+
sale_price?: number;
|
|
629
|
+
stock_quantity?: number;
|
|
630
|
+
value_ids: number[];
|
|
631
|
+
created_at?: string;
|
|
632
|
+
updated_at?: string;
|
|
633
|
+
[key: string]: any;
|
|
634
|
+
}
|
|
362
635
|
interface Product {
|
|
363
636
|
id: number | string;
|
|
364
637
|
name?: string;
|
|
@@ -372,6 +645,7 @@ interface Product {
|
|
|
372
645
|
slug_prefix?: string;
|
|
373
646
|
image?: string;
|
|
374
647
|
media?: MediaItem[] | MediaItem[][];
|
|
648
|
+
skus?: ProductSku[];
|
|
375
649
|
isActive?: boolean;
|
|
376
650
|
organizationId?: number;
|
|
377
651
|
createdAt?: string;
|
|
@@ -402,6 +676,20 @@ interface CreateProductRequest {
|
|
|
402
676
|
stock_quantity?: number | null;
|
|
403
677
|
isActive?: boolean;
|
|
404
678
|
}
|
|
679
|
+
interface CreateProductSkuRequest {
|
|
680
|
+
sku?: string | null;
|
|
681
|
+
media_id?: string | null;
|
|
682
|
+
unit_amount?: number;
|
|
683
|
+
currency?: string;
|
|
684
|
+
quantity_available?: number | null;
|
|
685
|
+
price?: number | null;
|
|
686
|
+
stock_quantity?: number | null;
|
|
687
|
+
sale_price?: number | null;
|
|
688
|
+
published?: boolean;
|
|
689
|
+
gateway_price_id_test?: string | null;
|
|
690
|
+
gateway_price_id_live?: string | null;
|
|
691
|
+
value_ids: number[];
|
|
692
|
+
}
|
|
405
693
|
interface ProductQueryParams extends PaginationParams {
|
|
406
694
|
organizationId?: number;
|
|
407
695
|
isActive?: boolean;
|
|
@@ -1459,34 +1747,11 @@ declare class ProductsClient extends BaseClient {
|
|
|
1459
1747
|
/**
|
|
1460
1748
|
* Get all SKUs for a product (with their option value combinations)
|
|
1461
1749
|
*/
|
|
1462
|
-
getProductSkus(siteName: string, productId: number): Promise<ApiResponse<
|
|
1463
|
-
sku_id: number;
|
|
1464
|
-
sku: string;
|
|
1465
|
-
price?: number;
|
|
1466
|
-
sale_price?: number;
|
|
1467
|
-
stock_quantity?: number;
|
|
1468
|
-
combination_key: string;
|
|
1469
|
-
value_ids: number[];
|
|
1470
|
-
created_at: string;
|
|
1471
|
-
updated_at: string;
|
|
1472
|
-
}>>>;
|
|
1750
|
+
getProductSkus(siteName: string, productId: number): Promise<ApiResponse<ProductSku[]>>;
|
|
1473
1751
|
/**
|
|
1474
1752
|
* Create or update a SKU for a product variant combination
|
|
1475
1753
|
*/
|
|
1476
|
-
createProductSku(siteName: string, productId: number, data:
|
|
1477
|
-
sku: string;
|
|
1478
|
-
price?: number | null;
|
|
1479
|
-
sale_price?: number | null;
|
|
1480
|
-
stock_quantity?: number | null;
|
|
1481
|
-
value_ids: number[];
|
|
1482
|
-
}): Promise<ApiResponse<{
|
|
1483
|
-
sku_id: number;
|
|
1484
|
-
sku: string;
|
|
1485
|
-
price?: number;
|
|
1486
|
-
sale_price?: number;
|
|
1487
|
-
stock_quantity?: number;
|
|
1488
|
-
combination_key: string;
|
|
1489
|
-
}>>;
|
|
1754
|
+
createProductSku(siteName: string, productId: number, data: CreateProductSkuRequest): Promise<ApiResponse<ProductSku>>;
|
|
1490
1755
|
}
|
|
1491
1756
|
|
|
1492
1757
|
/**
|
|
@@ -2102,150 +2367,6 @@ declare class NewsletterClient extends BaseClient {
|
|
|
2102
2367
|
* Check subscription status by email
|
|
2103
2368
|
*/
|
|
2104
2369
|
getStatus(siteName: string, email: string): Promise<ApiResponse<NewsletterStatusResponse>>;
|
|
2105
|
-
/**
|
|
2106
|
-
* Get all newsletter subscriptions (admin only)
|
|
2107
|
-
*/
|
|
2108
|
-
getSubscriptions(siteName: string, params?: {
|
|
2109
|
-
page?: number;
|
|
2110
|
-
limit?: number;
|
|
2111
|
-
status?: string;
|
|
2112
|
-
list_id?: string;
|
|
2113
|
-
search?: string;
|
|
2114
|
-
startDate?: string;
|
|
2115
|
-
endDate?: string;
|
|
2116
|
-
}): Promise<PaginatedResponse<NewsletterSubscription>>;
|
|
2117
|
-
/**
|
|
2118
|
-
* Get subscription by ID (admin only)
|
|
2119
|
-
*/
|
|
2120
|
-
getSubscriptionById(siteName: string, id: string): Promise<ApiResponse<NewsletterSubscription>>;
|
|
2121
|
-
/**
|
|
2122
|
-
* Update subscription status (admin only)
|
|
2123
|
-
*/
|
|
2124
|
-
updateSubscriptionStatus(siteName: string, id: string, status: 'confirmed' | 'unsubscribed' | 'bounced' | 'complained', notes?: string): Promise<ApiResponse<{
|
|
2125
|
-
message: string;
|
|
2126
|
-
}>>;
|
|
2127
|
-
/**
|
|
2128
|
-
* Delete subscription (admin only)
|
|
2129
|
-
*/
|
|
2130
|
-
deleteSubscription(siteName: string, id: string): Promise<ApiResponse<{
|
|
2131
|
-
message: string;
|
|
2132
|
-
}>>;
|
|
2133
|
-
/**
|
|
2134
|
-
* Bulk update subscriptions (admin only)
|
|
2135
|
-
*/
|
|
2136
|
-
bulkUpdateSubscriptions(siteName: string, data: {
|
|
2137
|
-
ids: string[];
|
|
2138
|
-
action: 'confirm' | 'unsubscribe' | 'delete' | 'add_to_list' | 'remove_from_list';
|
|
2139
|
-
list_id?: string;
|
|
2140
|
-
}): Promise<ApiResponse<{
|
|
2141
|
-
success: boolean;
|
|
2142
|
-
updatedCount: number;
|
|
2143
|
-
failedCount: number;
|
|
2144
|
-
}>>;
|
|
2145
|
-
/**
|
|
2146
|
-
* Create newsletter list (admin only)
|
|
2147
|
-
*/
|
|
2148
|
-
createList(siteName: string, data: {
|
|
2149
|
-
list_name: string;
|
|
2150
|
-
slug: string;
|
|
2151
|
-
description?: string;
|
|
2152
|
-
is_public?: boolean;
|
|
2153
|
-
is_default?: boolean;
|
|
2154
|
-
double_opt_in?: boolean;
|
|
2155
|
-
welcome_email_enabled?: boolean;
|
|
2156
|
-
}): Promise<ApiResponse<NewsletterList>>;
|
|
2157
|
-
/**
|
|
2158
|
-
* Update newsletter list (admin only)
|
|
2159
|
-
*/
|
|
2160
|
-
updateList(siteName: string, listId: string, data: Partial<{
|
|
2161
|
-
list_name: string;
|
|
2162
|
-
description: string;
|
|
2163
|
-
is_public: boolean;
|
|
2164
|
-
is_default: boolean;
|
|
2165
|
-
double_opt_in: boolean;
|
|
2166
|
-
welcome_email_enabled: boolean;
|
|
2167
|
-
}>): Promise<ApiResponse<{
|
|
2168
|
-
message: string;
|
|
2169
|
-
}>>;
|
|
2170
|
-
/**
|
|
2171
|
-
* Delete newsletter list (admin only)
|
|
2172
|
-
*/
|
|
2173
|
-
deleteList(siteName: string, listId: string): Promise<ApiResponse<{
|
|
2174
|
-
message: string;
|
|
2175
|
-
}>>;
|
|
2176
|
-
/**
|
|
2177
|
-
* Get newsletter statistics (admin only)
|
|
2178
|
-
*/
|
|
2179
|
-
getStatistics(siteName: string, params?: {
|
|
2180
|
-
startDate?: string;
|
|
2181
|
-
endDate?: string;
|
|
2182
|
-
list_id?: string;
|
|
2183
|
-
}): Promise<ApiResponse<{
|
|
2184
|
-
totalSubscribers: number;
|
|
2185
|
-
confirmedSubscribers: number;
|
|
2186
|
-
pendingSubscribers: number;
|
|
2187
|
-
unsubscribedCount: number;
|
|
2188
|
-
bouncedCount: number;
|
|
2189
|
-
subscribersByDay: Array<{
|
|
2190
|
-
date: string;
|
|
2191
|
-
count: number;
|
|
2192
|
-
}>;
|
|
2193
|
-
subscribersByList: Array<{
|
|
2194
|
-
list_id: string;
|
|
2195
|
-
list_name: string;
|
|
2196
|
-
count: number;
|
|
2197
|
-
}>;
|
|
2198
|
-
engagementMetrics: {
|
|
2199
|
-
averageOpenRate: number;
|
|
2200
|
-
averageClickRate: number;
|
|
2201
|
-
};
|
|
2202
|
-
}>>;
|
|
2203
|
-
/**
|
|
2204
|
-
* Export newsletter subscriptions (admin only)
|
|
2205
|
-
*/
|
|
2206
|
-
exportSubscriptions(siteName: string, params?: {
|
|
2207
|
-
format?: 'csv' | 'json' | 'xlsx';
|
|
2208
|
-
status?: string;
|
|
2209
|
-
list_id?: string;
|
|
2210
|
-
startDate?: string;
|
|
2211
|
-
endDate?: string;
|
|
2212
|
-
}): Promise<ApiResponse<{
|
|
2213
|
-
downloadUrl: string;
|
|
2214
|
-
expiresAt: string;
|
|
2215
|
-
}>>;
|
|
2216
|
-
/**
|
|
2217
|
-
* Import newsletter subscriptions (admin only)
|
|
2218
|
-
*/
|
|
2219
|
-
importSubscriptions(siteName: string, data: {
|
|
2220
|
-
subscriptions: Array<{
|
|
2221
|
-
email: string;
|
|
2222
|
-
name?: string;
|
|
2223
|
-
status?: string;
|
|
2224
|
-
lists?: string[];
|
|
2225
|
-
}>;
|
|
2226
|
-
skip_confirmation?: boolean;
|
|
2227
|
-
update_existing?: boolean;
|
|
2228
|
-
}): Promise<ApiResponse<{
|
|
2229
|
-
imported: number;
|
|
2230
|
-
updated: number;
|
|
2231
|
-
failed: number;
|
|
2232
|
-
errors?: Array<{
|
|
2233
|
-
email: string;
|
|
2234
|
-
error: string;
|
|
2235
|
-
}>;
|
|
2236
|
-
}>>;
|
|
2237
|
-
/**
|
|
2238
|
-
* Send test newsletter (admin only)
|
|
2239
|
-
*/
|
|
2240
|
-
sendTestNewsletter(siteName: string, data: {
|
|
2241
|
-
to: string;
|
|
2242
|
-
subject: string;
|
|
2243
|
-
html_content: string;
|
|
2244
|
-
text_content?: string;
|
|
2245
|
-
}): Promise<ApiResponse<{
|
|
2246
|
-
message: string;
|
|
2247
|
-
sent: boolean;
|
|
2248
|
-
}>>;
|
|
2249
2370
|
/**
|
|
2250
2371
|
* Track email open event.
|
|
2251
2372
|
* Called by client sites when their tracking pixel route is hit.
|
|
@@ -2280,6 +2401,171 @@ declare class NewsletterClient extends BaseClient {
|
|
|
2280
2401
|
private isCachePolicy;
|
|
2281
2402
|
}
|
|
2282
2403
|
|
|
2404
|
+
/**
|
|
2405
|
+
* Newsletter management client for PerspectAPI SDK
|
|
2406
|
+
* Strict management surface under /newsletter/management/*
|
|
2407
|
+
*/
|
|
2408
|
+
|
|
2409
|
+
declare class NewsletterManagementClient extends BaseClient {
|
|
2410
|
+
constructor(http: any, cache?: CacheManager);
|
|
2411
|
+
private managementEndpoint;
|
|
2412
|
+
listSubscriptions(siteName: string, params?: {
|
|
2413
|
+
page?: number;
|
|
2414
|
+
limit?: number;
|
|
2415
|
+
status?: 'pending' | 'confirmed' | 'unsubscribed' | 'bounced' | 'complained';
|
|
2416
|
+
list_id?: string;
|
|
2417
|
+
search?: string;
|
|
2418
|
+
startDate?: string;
|
|
2419
|
+
endDate?: string;
|
|
2420
|
+
}): Promise<ApiResponse<NewsletterManagementSubscriptionsListResponse>>;
|
|
2421
|
+
getSubscriptionById(siteName: string, subscriptionId: string): Promise<ApiResponse<NewsletterManagementSubscription>>;
|
|
2422
|
+
getSubscriptionByEmail(siteName: string, email: string): Promise<ApiResponse<NewsletterManagementSubscription>>;
|
|
2423
|
+
syncSubscription(siteName: string, data: NewsletterSubscriptionSyncRequest): Promise<ApiResponse<NewsletterSubscriptionSyncResponse>>;
|
|
2424
|
+
updateSubscription(siteName: string, subscriptionId: string, data: Omit<NewsletterSubscriptionSyncRequest, 'email'>): Promise<ApiResponse<NewsletterSubscriptionSyncResponse>>;
|
|
2425
|
+
deleteSubscription(siteName: string, subscriptionId: string): Promise<ApiResponse<{
|
|
2426
|
+
deleted: boolean;
|
|
2427
|
+
subscription_id: string;
|
|
2428
|
+
}>>;
|
|
2429
|
+
bulkUpdateSubscriptions(siteName: string, data: NewsletterSubscriptionsBulkUpdateRequest): Promise<ApiResponse<NewsletterSubscriptionsBulkUpdateResponse>>;
|
|
2430
|
+
updateSubscriptionListMembership(siteName: string, subscriptionId: string, data: NewsletterSubscriptionMembershipUpdateRequest): Promise<ApiResponse<{
|
|
2431
|
+
subscription: NewsletterManagementSubscription;
|
|
2432
|
+
mode: 'add' | 'remove' | 'replace';
|
|
2433
|
+
list_ids: string[];
|
|
2434
|
+
}>>;
|
|
2435
|
+
importSubscriptions(siteName: string, data: NewsletterSubscriptionsImportRequest): Promise<ApiResponse<NewsletterSubscriptionsImportResponse>>;
|
|
2436
|
+
listLists(siteName: string, params?: {
|
|
2437
|
+
status?: 'active' | 'archived';
|
|
2438
|
+
}): Promise<ApiResponse<{
|
|
2439
|
+
items: NewsletterManagementList[];
|
|
2440
|
+
total: number;
|
|
2441
|
+
}>>;
|
|
2442
|
+
getListById(siteName: string, listId: string): Promise<ApiResponse<NewsletterManagementList>>;
|
|
2443
|
+
createList(siteName: string, data: {
|
|
2444
|
+
list_name: string;
|
|
2445
|
+
slug: string;
|
|
2446
|
+
description?: string | null;
|
|
2447
|
+
is_public?: boolean;
|
|
2448
|
+
is_default?: boolean;
|
|
2449
|
+
double_opt_in?: boolean;
|
|
2450
|
+
welcome_email_enabled?: boolean;
|
|
2451
|
+
}): Promise<ApiResponse<NewsletterManagementList>>;
|
|
2452
|
+
updateList(siteName: string, listId: string, data: Partial<{
|
|
2453
|
+
list_name: string | null;
|
|
2454
|
+
slug: string | null;
|
|
2455
|
+
description: string | null;
|
|
2456
|
+
is_public: boolean;
|
|
2457
|
+
is_default: boolean;
|
|
2458
|
+
double_opt_in: boolean;
|
|
2459
|
+
welcome_email_enabled: boolean;
|
|
2460
|
+
status: 'active' | 'archived';
|
|
2461
|
+
}>): Promise<ApiResponse<NewsletterManagementList>>;
|
|
2462
|
+
deleteList(siteName: string, listId: string): Promise<ApiResponse<{
|
|
2463
|
+
deleted: boolean;
|
|
2464
|
+
list_id: string;
|
|
2465
|
+
}>>;
|
|
2466
|
+
listSeries(siteName: string, params?: {
|
|
2467
|
+
status?: 'active' | 'paused' | 'archived';
|
|
2468
|
+
}): Promise<ApiResponse<{
|
|
2469
|
+
items: NewsletterManagementSeries[];
|
|
2470
|
+
total: number;
|
|
2471
|
+
}>>;
|
|
2472
|
+
getSeriesById(siteName: string, seriesId: string): Promise<ApiResponse<NewsletterManagementSeries>>;
|
|
2473
|
+
createSeries(siteName: string, data: {
|
|
2474
|
+
series_name: string;
|
|
2475
|
+
description?: string | null;
|
|
2476
|
+
status?: 'active' | 'paused' | 'archived';
|
|
2477
|
+
cadence?: 'manual' | 'daily' | 'weekly' | 'monthly';
|
|
2478
|
+
timezone?: string | null;
|
|
2479
|
+
send_time?: string | null;
|
|
2480
|
+
day_of_week?: number | null;
|
|
2481
|
+
day_of_month?: number | null;
|
|
2482
|
+
next_send_at?: string | null;
|
|
2483
|
+
list_ids?: string[];
|
|
2484
|
+
from_name?: string | null;
|
|
2485
|
+
from_email?: string | null;
|
|
2486
|
+
reply_to_email?: string | null;
|
|
2487
|
+
subject_prefix?: string | null;
|
|
2488
|
+
tags?: string[];
|
|
2489
|
+
notes?: string | null;
|
|
2490
|
+
}): Promise<ApiResponse<NewsletterManagementSeries>>;
|
|
2491
|
+
updateSeries(siteName: string, seriesId: string, data: Partial<{
|
|
2492
|
+
series_name: string;
|
|
2493
|
+
description?: string | null;
|
|
2494
|
+
status?: 'active' | 'paused' | 'archived';
|
|
2495
|
+
cadence?: 'manual' | 'daily' | 'weekly' | 'monthly';
|
|
2496
|
+
timezone?: string | null;
|
|
2497
|
+
send_time?: string | null;
|
|
2498
|
+
day_of_week?: number | null;
|
|
2499
|
+
day_of_month?: number | null;
|
|
2500
|
+
next_send_at?: string | null;
|
|
2501
|
+
list_ids?: string[];
|
|
2502
|
+
from_name?: string | null;
|
|
2503
|
+
from_email?: string | null;
|
|
2504
|
+
reply_to_email?: string | null;
|
|
2505
|
+
subject_prefix?: string | null;
|
|
2506
|
+
tags?: string[];
|
|
2507
|
+
notes?: string | null;
|
|
2508
|
+
}>): Promise<ApiResponse<NewsletterManagementSeries>>;
|
|
2509
|
+
deleteSeries(siteName: string, seriesId: string): Promise<ApiResponse<{
|
|
2510
|
+
deleted: boolean;
|
|
2511
|
+
series_id: string;
|
|
2512
|
+
}>>;
|
|
2513
|
+
listCampaigns(siteName: string, params?: {
|
|
2514
|
+
page?: number;
|
|
2515
|
+
limit?: number;
|
|
2516
|
+
status?: 'draft' | 'scheduled' | 'sending' | 'sent' | 'cancelled';
|
|
2517
|
+
}): Promise<ApiResponse<NewsletterManagementCampaignListResponse>>;
|
|
2518
|
+
getCampaignById(siteName: string, campaignId: string): Promise<ApiResponse<NewsletterManagementCampaign>>;
|
|
2519
|
+
createCampaign(siteName: string, data: {
|
|
2520
|
+
campaign_name: string;
|
|
2521
|
+
subject: string;
|
|
2522
|
+
markdown_content: string;
|
|
2523
|
+
slug?: string | null;
|
|
2524
|
+
slug_prefix?: string | null;
|
|
2525
|
+
status?: 'draft' | 'scheduled' | 'cancelled';
|
|
2526
|
+
scheduled_at?: string | null;
|
|
2527
|
+
preview_text?: string | null;
|
|
2528
|
+
from_name?: string | null;
|
|
2529
|
+
from_email?: string | null;
|
|
2530
|
+
reply_to_email?: string | null;
|
|
2531
|
+
template_id?: string | null;
|
|
2532
|
+
series_id?: string | null;
|
|
2533
|
+
list_ids?: string[];
|
|
2534
|
+
tags?: string[];
|
|
2535
|
+
notes?: string | null;
|
|
2536
|
+
}): Promise<ApiResponse<NewsletterManagementCampaign>>;
|
|
2537
|
+
updateCampaign(siteName: string, campaignId: string, data: Partial<{
|
|
2538
|
+
campaign_name: string;
|
|
2539
|
+
subject: string;
|
|
2540
|
+
markdown_content: string;
|
|
2541
|
+
slug?: string | null;
|
|
2542
|
+
slug_prefix?: string | null;
|
|
2543
|
+
status?: 'draft' | 'scheduled' | 'cancelled';
|
|
2544
|
+
scheduled_at?: string | null;
|
|
2545
|
+
preview_text?: string | null;
|
|
2546
|
+
from_name?: string | null;
|
|
2547
|
+
from_email?: string | null;
|
|
2548
|
+
reply_to_email?: string | null;
|
|
2549
|
+
template_id?: string | null;
|
|
2550
|
+
series_id?: string | null;
|
|
2551
|
+
list_ids?: string[];
|
|
2552
|
+
tags?: string[];
|
|
2553
|
+
notes?: string | null;
|
|
2554
|
+
}>): Promise<ApiResponse<NewsletterManagementCampaign>>;
|
|
2555
|
+
deleteCampaign(siteName: string, campaignId: string): Promise<ApiResponse<{
|
|
2556
|
+
deleted: boolean;
|
|
2557
|
+
campaign_id: string;
|
|
2558
|
+
}>>;
|
|
2559
|
+
sendCampaignTest(siteName: string, campaignId: string, data: NewsletterCampaignTestSendRequest): Promise<ApiResponse<NewsletterCampaignTestSendResponse>>;
|
|
2560
|
+
getStats(siteName: string, params?: {
|
|
2561
|
+
startDate?: string;
|
|
2562
|
+
endDate?: string;
|
|
2563
|
+
list_id?: string;
|
|
2564
|
+
}): Promise<ApiResponse<NewsletterManagementStatsResponse>>;
|
|
2565
|
+
createExport(siteName: string, data: NewsletterExportCreateRequest): Promise<ApiResponse<NewsletterExportCreateResponse>>;
|
|
2566
|
+
downloadExport(siteName: string, exportId: string): Promise<ApiResponse<string>>;
|
|
2567
|
+
}
|
|
2568
|
+
|
|
2283
2569
|
/**
|
|
2284
2570
|
* Site Users client for PerspectAPI SDK
|
|
2285
2571
|
* Handles per-site customer accounts (OTP-based auth, profiles, orders, subscriptions)
|
|
@@ -2681,6 +2967,7 @@ declare class PerspectApiClient {
|
|
|
2681
2967
|
readonly checkout: CheckoutClient;
|
|
2682
2968
|
readonly contact: ContactClient;
|
|
2683
2969
|
readonly newsletter: NewsletterClient;
|
|
2970
|
+
readonly newsletterManagement: NewsletterManagementClient;
|
|
2684
2971
|
readonly siteUsers: SiteUsersClient;
|
|
2685
2972
|
readonly bundles: BundlesClient;
|
|
2686
2973
|
constructor(config: PerspectApiConfig);
|
|
@@ -3087,4 +3374,4 @@ declare function createCheckoutSession(options: CheckoutSessionOptions): Promise
|
|
|
3087
3374
|
error: string;
|
|
3088
3375
|
}>;
|
|
3089
3376
|
|
|
3090
|
-
export { type AddCollectionItemRequest, type ApiError, type ApiKey, ApiKeysClient, type ApiResponse, AuthClient, BaseClient, type BlogPost, type BundleCollection, type BundleCollectionItem, type BundleCollectionItemWithProduct, BundlesClient, type CacheConfig, CacheManager, CategoriesClient, type Category, type CategorySummary, type CheckoutAddress, CheckoutClient, type CheckoutMetadata, type CheckoutMetadataValue, type CheckoutSession, type CheckoutSessionOptions, type CheckoutSessionTax, type CheckoutTaxBreakdownItem, type CheckoutTaxCustomerExemptionRequest, type CheckoutTaxExemptionStatus, type CheckoutTaxRequest, type CheckoutTaxStrategy, ContactClient, type ContactStatusResponse, type ContactSubmission, type ContactSubmitResponse, type Content, type ContentCategoryResponse, ContentClient, type ContentQueryParams, type ContentStatus, type ContentType, type CreateApiKeyRequest, type CreateBundleCollectionRequest, type CreateBundleGroupRequest, type CreateCategoryRequest, type CreateCheckoutSessionRequest, type CreateContactRequest, type CreateContentRequest, type CreateNewsletterSubscriptionRequest, type CreateOrganizationRequest, type CreatePaymentGatewayRequest, type CreateProductRequest, type CreateSiteRequest, type CreateWebhookRequest, type CreditBalance, type CreditBalanceWithTransactions, type CreditTransaction, DEFAULT_IMAGE_SIZES, 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, NewsletterClient, type NewsletterConfirmResponse, type NewsletterList, type NewsletterPreferences, type NewsletterStatusResponse, type NewsletterSubscribeResponse, type NewsletterSubscription, type NewsletterUnsubscribeRequest, type NewsletterUnsubscribeResponse, NoopCacheAdapter, type Organization, OrganizationsClient, type PaginatedResponse, type PaginationParams, type PaymentGateway, PerspectApiClient, type PerspectApiConfig, type Product, type ProductBundleGroup, type ProductQueryParams, ProductsClient, type RequestOptions, type RequestOtpRequest, type ResponsiveImageSizes, type SetProfileValueRequest, type Site, type SiteUser, type SiteUserOrder, type SiteUserProfile, type SiteUserSubscription, SiteUsersClient, SitesClient, type UpdateApiKeyRequest, type UpdateContentRequest, type UpdateSiteUserRequest, type User, type VerifyOtpRequest, type VerifyOtpResponse, type Webhook, WebhooksClient, buildImageUrl, createApiError, createCheckoutSession, createPerspectApiClient, PerspectApiClient as default, generateResponsiveImageHtml, generateResponsiveUrls, generateSizesAttribute, generateSrcSet, loadAllContent, loadContentBySlug, loadPages, loadPosts, loadProductBySlug, loadProducts, transformContent, transformMediaItem, transformProduct };
|
|
3377
|
+
export { type AddCollectionItemRequest, type ApiError, type ApiKey, ApiKeysClient, type ApiResponse, AuthClient, BaseClient, type BlogPost, type BundleCollection, type BundleCollectionItem, type BundleCollectionItemWithProduct, BundlesClient, type CacheConfig, CacheManager, CategoriesClient, type Category, type CategorySummary, type CheckoutAddress, CheckoutClient, type CheckoutMetadata, type CheckoutMetadataValue, type CheckoutSession, type CheckoutSessionOptions, type CheckoutSessionTax, type CheckoutTaxBreakdownItem, type CheckoutTaxCustomerExemptionRequest, type CheckoutTaxExemptionStatus, type CheckoutTaxRequest, type CheckoutTaxStrategy, ContactClient, type ContactStatusResponse, type ContactSubmission, type ContactSubmitResponse, type Content, type ContentCategoryResponse, ContentClient, type ContentQueryParams, type ContentStatus, type ContentType, type CreateApiKeyRequest, type CreateBundleCollectionRequest, type CreateBundleGroupRequest, type CreateCategoryRequest, type CreateCheckoutSessionRequest, type CreateContactRequest, type CreateContentRequest, type CreateNewsletterSubscriptionRequest, type CreateOrganizationRequest, type CreatePaymentGatewayRequest, type CreateProductRequest, type 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, 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 UpdateApiKeyRequest, type UpdateContentRequest, type UpdateSiteUserRequest, type User, type VerifyOtpRequest, type VerifyOtpResponse, type Webhook, WebhooksClient, buildImageUrl, createApiError, createCheckoutSession, createPerspectApiClient, PerspectApiClient as default, generateResponsiveImageHtml, generateResponsiveUrls, generateSizesAttribute, generateSrcSet, loadAllContent, loadContentBySlug, loadPages, loadPosts, loadProductBySlug, loadProducts, transformContent, transformMediaItem, transformProduct };
|