perspectapi-ts-sdk 5.0.1 → 5.0.3
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 +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +11 -0
- package/dist/index.mjs +11 -0
- package/package.json +1 -1
- package/src/client/newsletter-management-client.ts +0 -2
- package/src/types/index.ts +0 -1
- package/src/v2/client/newsletter-client.ts +21 -2
- package/src/v2/types.ts +4 -0
package/dist/index.d.mts
CHANGED
|
@@ -191,7 +191,6 @@ interface CreateNewsletterSubscriptionRequest {
|
|
|
191
191
|
language?: string;
|
|
192
192
|
source?: string;
|
|
193
193
|
source_url?: string;
|
|
194
|
-
double_opt_in?: boolean;
|
|
195
194
|
metadata?: Record<string, any>;
|
|
196
195
|
}
|
|
197
196
|
interface NewsletterList {
|
|
@@ -2466,7 +2465,6 @@ declare class NewsletterManagementClient extends BaseClient {
|
|
|
2466
2465
|
description?: string | null;
|
|
2467
2466
|
is_public?: boolean;
|
|
2468
2467
|
is_default?: boolean;
|
|
2469
|
-
double_opt_in?: boolean;
|
|
2470
2468
|
welcome_email_enabled?: boolean;
|
|
2471
2469
|
}): Promise<ApiResponse<NewsletterManagementList>>;
|
|
2472
2470
|
updateList(siteName: string, listId: string, data: Partial<{
|
|
@@ -2475,7 +2473,6 @@ declare class NewsletterManagementClient extends BaseClient {
|
|
|
2475
2473
|
description: string | null;
|
|
2476
2474
|
is_public: boolean;
|
|
2477
2475
|
is_default: boolean;
|
|
2478
|
-
double_opt_in: boolean;
|
|
2479
2476
|
welcome_email_enabled: boolean;
|
|
2480
2477
|
status: 'active' | 'archived';
|
|
2481
2478
|
}>): Promise<ApiResponse<NewsletterManagementList>>;
|
|
@@ -3341,6 +3338,9 @@ interface V2NewsletterCampaign extends V2Object {
|
|
|
3341
3338
|
created_at: string | null;
|
|
3342
3339
|
updated_at: string | null;
|
|
3343
3340
|
}
|
|
3341
|
+
interface V2NewsletterTrackingResponse {
|
|
3342
|
+
success: boolean;
|
|
3343
|
+
}
|
|
3344
3344
|
interface V2ContactSubmission extends V2Object {
|
|
3345
3345
|
object: "contact_submission";
|
|
3346
3346
|
name: string | null;
|
|
@@ -3571,7 +3571,6 @@ declare class NewsletterV2Client extends BaseV2Client {
|
|
|
3571
3571
|
email: string;
|
|
3572
3572
|
name?: string;
|
|
3573
3573
|
list_ids?: string[];
|
|
3574
|
-
double_opt_in?: boolean;
|
|
3575
3574
|
source?: string;
|
|
3576
3575
|
source_url?: string;
|
|
3577
3576
|
frequency?: 'instant' | 'daily' | 'weekly' | 'monthly';
|
|
@@ -3585,6 +3584,8 @@ declare class NewsletterV2Client extends BaseV2Client {
|
|
|
3585
3584
|
email?: string;
|
|
3586
3585
|
reason?: string;
|
|
3587
3586
|
}): Promise<V2NewsletterSubscription>;
|
|
3587
|
+
trackOpen(siteName: string, token: string): Promise<V2NewsletterTrackingResponse>;
|
|
3588
|
+
trackClick(siteName: string, token: string, url: string): Promise<V2NewsletterTrackingResponse>;
|
|
3588
3589
|
listSubscriptions(siteName: string, params?: V2PaginationParams & {
|
|
3589
3590
|
status?: string;
|
|
3590
3591
|
}): Promise<V2List<V2NewsletterSubscription>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -191,7 +191,6 @@ interface CreateNewsletterSubscriptionRequest {
|
|
|
191
191
|
language?: string;
|
|
192
192
|
source?: string;
|
|
193
193
|
source_url?: string;
|
|
194
|
-
double_opt_in?: boolean;
|
|
195
194
|
metadata?: Record<string, any>;
|
|
196
195
|
}
|
|
197
196
|
interface NewsletterList {
|
|
@@ -2466,7 +2465,6 @@ declare class NewsletterManagementClient extends BaseClient {
|
|
|
2466
2465
|
description?: string | null;
|
|
2467
2466
|
is_public?: boolean;
|
|
2468
2467
|
is_default?: boolean;
|
|
2469
|
-
double_opt_in?: boolean;
|
|
2470
2468
|
welcome_email_enabled?: boolean;
|
|
2471
2469
|
}): Promise<ApiResponse<NewsletterManagementList>>;
|
|
2472
2470
|
updateList(siteName: string, listId: string, data: Partial<{
|
|
@@ -2475,7 +2473,6 @@ declare class NewsletterManagementClient extends BaseClient {
|
|
|
2475
2473
|
description: string | null;
|
|
2476
2474
|
is_public: boolean;
|
|
2477
2475
|
is_default: boolean;
|
|
2478
|
-
double_opt_in: boolean;
|
|
2479
2476
|
welcome_email_enabled: boolean;
|
|
2480
2477
|
status: 'active' | 'archived';
|
|
2481
2478
|
}>): Promise<ApiResponse<NewsletterManagementList>>;
|
|
@@ -3341,6 +3338,9 @@ interface V2NewsletterCampaign extends V2Object {
|
|
|
3341
3338
|
created_at: string | null;
|
|
3342
3339
|
updated_at: string | null;
|
|
3343
3340
|
}
|
|
3341
|
+
interface V2NewsletterTrackingResponse {
|
|
3342
|
+
success: boolean;
|
|
3343
|
+
}
|
|
3344
3344
|
interface V2ContactSubmission extends V2Object {
|
|
3345
3345
|
object: "contact_submission";
|
|
3346
3346
|
name: string | null;
|
|
@@ -3571,7 +3571,6 @@ declare class NewsletterV2Client extends BaseV2Client {
|
|
|
3571
3571
|
email: string;
|
|
3572
3572
|
name?: string;
|
|
3573
3573
|
list_ids?: string[];
|
|
3574
|
-
double_opt_in?: boolean;
|
|
3575
3574
|
source?: string;
|
|
3576
3575
|
source_url?: string;
|
|
3577
3576
|
frequency?: 'instant' | 'daily' | 'weekly' | 'monthly';
|
|
@@ -3585,6 +3584,8 @@ declare class NewsletterV2Client extends BaseV2Client {
|
|
|
3585
3584
|
email?: string;
|
|
3586
3585
|
reason?: string;
|
|
3587
3586
|
}): Promise<V2NewsletterSubscription>;
|
|
3587
|
+
trackOpen(siteName: string, token: string): Promise<V2NewsletterTrackingResponse>;
|
|
3588
|
+
trackClick(siteName: string, token: string, url: string): Promise<V2NewsletterTrackingResponse>;
|
|
3588
3589
|
listSubscriptions(siteName: string, params?: V2PaginationParams & {
|
|
3589
3590
|
status?: string;
|
|
3590
3591
|
}): Promise<V2List<V2NewsletterSubscription>>;
|
package/dist/index.js
CHANGED
|
@@ -3617,6 +3617,17 @@ var NewsletterV2Client = class extends BaseV2Client {
|
|
|
3617
3617
|
data
|
|
3618
3618
|
);
|
|
3619
3619
|
}
|
|
3620
|
+
async trackOpen(siteName, token) {
|
|
3621
|
+
return this.post(
|
|
3622
|
+
this.sitePath(siteName, "newsletter", `track/open/${encodeURIComponent(token)}`)
|
|
3623
|
+
);
|
|
3624
|
+
}
|
|
3625
|
+
async trackClick(siteName, token, url) {
|
|
3626
|
+
return this.post(
|
|
3627
|
+
this.sitePath(siteName, "newsletter", `track/click/${encodeURIComponent(token)}`),
|
|
3628
|
+
{ url }
|
|
3629
|
+
);
|
|
3630
|
+
}
|
|
3620
3631
|
// --- Subscriptions (admin) ---
|
|
3621
3632
|
async listSubscriptions(siteName, params) {
|
|
3622
3633
|
return this.getList(
|
package/dist/index.mjs
CHANGED
|
@@ -3550,6 +3550,17 @@ var NewsletterV2Client = class extends BaseV2Client {
|
|
|
3550
3550
|
data
|
|
3551
3551
|
);
|
|
3552
3552
|
}
|
|
3553
|
+
async trackOpen(siteName, token) {
|
|
3554
|
+
return this.post(
|
|
3555
|
+
this.sitePath(siteName, "newsletter", `track/open/${encodeURIComponent(token)}`)
|
|
3556
|
+
);
|
|
3557
|
+
}
|
|
3558
|
+
async trackClick(siteName, token, url) {
|
|
3559
|
+
return this.post(
|
|
3560
|
+
this.sitePath(siteName, "newsletter", `track/click/${encodeURIComponent(token)}`),
|
|
3561
|
+
{ url }
|
|
3562
|
+
);
|
|
3563
|
+
}
|
|
3553
3564
|
// --- Subscriptions (admin) ---
|
|
3554
3565
|
async listSubscriptions(siteName, params) {
|
|
3555
3566
|
return this.getList(
|
package/package.json
CHANGED
|
@@ -175,7 +175,6 @@ export class NewsletterManagementClient extends BaseClient {
|
|
|
175
175
|
description?: string | null;
|
|
176
176
|
is_public?: boolean;
|
|
177
177
|
is_default?: boolean;
|
|
178
|
-
double_opt_in?: boolean;
|
|
179
178
|
welcome_email_enabled?: boolean;
|
|
180
179
|
},
|
|
181
180
|
): Promise<ApiResponse<NewsletterManagementList>> {
|
|
@@ -191,7 +190,6 @@ export class NewsletterManagementClient extends BaseClient {
|
|
|
191
190
|
description: string | null;
|
|
192
191
|
is_public: boolean;
|
|
193
192
|
is_default: boolean;
|
|
194
|
-
double_opt_in: boolean;
|
|
195
193
|
welcome_email_enabled: boolean;
|
|
196
194
|
status: 'active' | 'archived';
|
|
197
195
|
}>,
|
package/src/types/index.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { BaseV2Client } from './base-v2-client';
|
|
6
6
|
import type {
|
|
7
7
|
V2NewsletterSubscription, V2NewsletterList, V2NewsletterCampaign,
|
|
8
|
-
V2PaginationParams, V2List,
|
|
8
|
+
V2PaginationParams, V2List, V2NewsletterTrackingResponse,
|
|
9
9
|
} from '../types';
|
|
10
10
|
|
|
11
11
|
export class NewsletterV2Client extends BaseV2Client {
|
|
@@ -18,7 +18,6 @@ export class NewsletterV2Client extends BaseV2Client {
|
|
|
18
18
|
email: string;
|
|
19
19
|
name?: string;
|
|
20
20
|
list_ids?: string[];
|
|
21
|
-
double_opt_in?: boolean;
|
|
22
21
|
source?: string;
|
|
23
22
|
source_url?: string;
|
|
24
23
|
frequency?: 'instant' | 'daily' | 'weekly' | 'monthly';
|
|
@@ -49,6 +48,26 @@ export class NewsletterV2Client extends BaseV2Client {
|
|
|
49
48
|
);
|
|
50
49
|
}
|
|
51
50
|
|
|
51
|
+
async trackOpen(
|
|
52
|
+
siteName: string,
|
|
53
|
+
token: string,
|
|
54
|
+
): Promise<V2NewsletterTrackingResponse> {
|
|
55
|
+
return this.post<V2NewsletterTrackingResponse>(
|
|
56
|
+
this.sitePath(siteName, 'newsletter', `track/open/${encodeURIComponent(token)}`),
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async trackClick(
|
|
61
|
+
siteName: string,
|
|
62
|
+
token: string,
|
|
63
|
+
url: string,
|
|
64
|
+
): Promise<V2NewsletterTrackingResponse> {
|
|
65
|
+
return this.post<V2NewsletterTrackingResponse>(
|
|
66
|
+
this.sitePath(siteName, 'newsletter', `track/click/${encodeURIComponent(token)}`),
|
|
67
|
+
{ url },
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
52
71
|
// --- Subscriptions (admin) ---
|
|
53
72
|
|
|
54
73
|
async listSubscriptions(
|
package/src/v2/types.ts
CHANGED
|
@@ -311,6 +311,10 @@ export interface V2NewsletterCampaign extends V2Object {
|
|
|
311
311
|
updated_at: string | null;
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
+
export interface V2NewsletterTrackingResponse {
|
|
315
|
+
success: boolean;
|
|
316
|
+
}
|
|
317
|
+
|
|
314
318
|
// --- Contact ---
|
|
315
319
|
|
|
316
320
|
export interface V2ContactSubmission extends V2Object {
|