perspectapi-ts-sdk 5.0.2 → 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 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +11 -0
- package/dist/index.mjs +11 -0
- package/package.json +1 -1
- package/src/v2/client/newsletter-client.ts +21 -1
- package/src/v2/types.ts +4 -0
package/dist/index.d.mts
CHANGED
|
@@ -3338,6 +3338,9 @@ interface V2NewsletterCampaign extends V2Object {
|
|
|
3338
3338
|
created_at: string | null;
|
|
3339
3339
|
updated_at: string | null;
|
|
3340
3340
|
}
|
|
3341
|
+
interface V2NewsletterTrackingResponse {
|
|
3342
|
+
success: boolean;
|
|
3343
|
+
}
|
|
3341
3344
|
interface V2ContactSubmission extends V2Object {
|
|
3342
3345
|
object: "contact_submission";
|
|
3343
3346
|
name: string | null;
|
|
@@ -3581,6 +3584,8 @@ declare class NewsletterV2Client extends BaseV2Client {
|
|
|
3581
3584
|
email?: string;
|
|
3582
3585
|
reason?: string;
|
|
3583
3586
|
}): Promise<V2NewsletterSubscription>;
|
|
3587
|
+
trackOpen(siteName: string, token: string): Promise<V2NewsletterTrackingResponse>;
|
|
3588
|
+
trackClick(siteName: string, token: string, url: string): Promise<V2NewsletterTrackingResponse>;
|
|
3584
3589
|
listSubscriptions(siteName: string, params?: V2PaginationParams & {
|
|
3585
3590
|
status?: string;
|
|
3586
3591
|
}): Promise<V2List<V2NewsletterSubscription>>;
|
package/dist/index.d.ts
CHANGED
|
@@ -3338,6 +3338,9 @@ interface V2NewsletterCampaign extends V2Object {
|
|
|
3338
3338
|
created_at: string | null;
|
|
3339
3339
|
updated_at: string | null;
|
|
3340
3340
|
}
|
|
3341
|
+
interface V2NewsletterTrackingResponse {
|
|
3342
|
+
success: boolean;
|
|
3343
|
+
}
|
|
3341
3344
|
interface V2ContactSubmission extends V2Object {
|
|
3342
3345
|
object: "contact_submission";
|
|
3343
3346
|
name: string | null;
|
|
@@ -3581,6 +3584,8 @@ declare class NewsletterV2Client extends BaseV2Client {
|
|
|
3581
3584
|
email?: string;
|
|
3582
3585
|
reason?: string;
|
|
3583
3586
|
}): Promise<V2NewsletterSubscription>;
|
|
3587
|
+
trackOpen(siteName: string, token: string): Promise<V2NewsletterTrackingResponse>;
|
|
3588
|
+
trackClick(siteName: string, token: string, url: string): Promise<V2NewsletterTrackingResponse>;
|
|
3584
3589
|
listSubscriptions(siteName: string, params?: V2PaginationParams & {
|
|
3585
3590
|
status?: string;
|
|
3586
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
|
@@ -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 {
|
|
@@ -48,6 +48,26 @@ export class NewsletterV2Client extends BaseV2Client {
|
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
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
|
+
|
|
51
71
|
// --- Subscriptions (admin) ---
|
|
52
72
|
|
|
53
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 {
|