perspectapi-ts-sdk 3.7.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 +400 -145
- package/dist/index.d.ts +400 -145
- package/dist/index.js +179 -106
- package/dist/index.mjs +178 -106
- package/package.json +1 -1
- package/src/client/newsletter-client.ts +0 -242
- package/src/client/newsletter-management-client.ts +426 -0
- package/src/index.ts +25 -0
- package/src/perspect-api-client.ts +3 -0
- package/src/types/index.ts +263 -0
package/dist/index.js
CHANGED
|
@@ -33,6 +33,7 @@ __export(index_exports, {
|
|
|
33
33
|
HttpClient: () => HttpClient,
|
|
34
34
|
InMemoryCacheAdapter: () => InMemoryCacheAdapter,
|
|
35
35
|
NewsletterClient: () => NewsletterClient,
|
|
36
|
+
NewsletterManagementClient: () => NewsletterManagementClient,
|
|
36
37
|
NoopCacheAdapter: () => NoopCacheAdapter,
|
|
37
38
|
OrganizationsClient: () => OrganizationsClient,
|
|
38
39
|
PerspectApiClient: () => PerspectApiClient,
|
|
@@ -2221,112 +2222,6 @@ var NewsletterClient = class extends BaseClient {
|
|
|
2221
2222
|
{ email }
|
|
2222
2223
|
);
|
|
2223
2224
|
}
|
|
2224
|
-
// Admin methods (require authentication)
|
|
2225
|
-
/**
|
|
2226
|
-
* Get all newsletter subscriptions (admin only)
|
|
2227
|
-
*/
|
|
2228
|
-
async getSubscriptions(siteName, params) {
|
|
2229
|
-
return this.getPaginated(
|
|
2230
|
-
this.newsletterEndpoint(siteName, "/newsletter/subscriptions"),
|
|
2231
|
-
params
|
|
2232
|
-
);
|
|
2233
|
-
}
|
|
2234
|
-
/**
|
|
2235
|
-
* Get subscription by ID (admin only)
|
|
2236
|
-
*/
|
|
2237
|
-
async getSubscriptionById(siteName, id) {
|
|
2238
|
-
return this.getSingle(
|
|
2239
|
-
this.newsletterEndpoint(siteName, `/newsletter/subscriptions/${encodeURIComponent(id)}`)
|
|
2240
|
-
);
|
|
2241
|
-
}
|
|
2242
|
-
/**
|
|
2243
|
-
* Update subscription status (admin only)
|
|
2244
|
-
*/
|
|
2245
|
-
async updateSubscriptionStatus(siteName, id, status, notes) {
|
|
2246
|
-
return this.patch(
|
|
2247
|
-
this.newsletterEndpoint(siteName, `/newsletter/subscriptions/${encodeURIComponent(id)}`),
|
|
2248
|
-
{ status, notes }
|
|
2249
|
-
);
|
|
2250
|
-
}
|
|
2251
|
-
/**
|
|
2252
|
-
* Delete subscription (admin only)
|
|
2253
|
-
*/
|
|
2254
|
-
async deleteSubscription(siteName, id) {
|
|
2255
|
-
return this.delete(
|
|
2256
|
-
this.newsletterEndpoint(siteName, `/newsletter/subscriptions/${encodeURIComponent(id)}`)
|
|
2257
|
-
);
|
|
2258
|
-
}
|
|
2259
|
-
/**
|
|
2260
|
-
* Bulk update subscriptions (admin only)
|
|
2261
|
-
*/
|
|
2262
|
-
async bulkUpdateSubscriptions(siteName, data) {
|
|
2263
|
-
return this.create(
|
|
2264
|
-
this.newsletterEndpoint(siteName, "/newsletter/subscriptions/bulk-update"),
|
|
2265
|
-
data
|
|
2266
|
-
);
|
|
2267
|
-
}
|
|
2268
|
-
/**
|
|
2269
|
-
* Create newsletter list (admin only)
|
|
2270
|
-
*/
|
|
2271
|
-
async createList(siteName, data) {
|
|
2272
|
-
return this.create(
|
|
2273
|
-
this.newsletterEndpoint(siteName, "/newsletter/lists"),
|
|
2274
|
-
data
|
|
2275
|
-
);
|
|
2276
|
-
}
|
|
2277
|
-
/**
|
|
2278
|
-
* Update newsletter list (admin only)
|
|
2279
|
-
*/
|
|
2280
|
-
async updateList(siteName, listId, data) {
|
|
2281
|
-
return this.update(
|
|
2282
|
-
this.newsletterEndpoint(siteName, `/newsletter/lists/${encodeURIComponent(listId)}`),
|
|
2283
|
-
data
|
|
2284
|
-
);
|
|
2285
|
-
}
|
|
2286
|
-
/**
|
|
2287
|
-
* Delete newsletter list (admin only)
|
|
2288
|
-
*/
|
|
2289
|
-
async deleteList(siteName, listId) {
|
|
2290
|
-
return this.delete(
|
|
2291
|
-
this.newsletterEndpoint(siteName, `/newsletter/lists/${encodeURIComponent(listId)}`)
|
|
2292
|
-
);
|
|
2293
|
-
}
|
|
2294
|
-
/**
|
|
2295
|
-
* Get newsletter statistics (admin only)
|
|
2296
|
-
*/
|
|
2297
|
-
async getStatistics(siteName, params) {
|
|
2298
|
-
return this.http.get(
|
|
2299
|
-
this.buildPath(this.newsletterEndpoint(siteName, "/newsletter/statistics")),
|
|
2300
|
-
params
|
|
2301
|
-
);
|
|
2302
|
-
}
|
|
2303
|
-
/**
|
|
2304
|
-
* Export newsletter subscriptions (admin only)
|
|
2305
|
-
*/
|
|
2306
|
-
async exportSubscriptions(siteName, params) {
|
|
2307
|
-
return this.create(
|
|
2308
|
-
this.newsletterEndpoint(siteName, "/newsletter/export"),
|
|
2309
|
-
params || {}
|
|
2310
|
-
);
|
|
2311
|
-
}
|
|
2312
|
-
/**
|
|
2313
|
-
* Import newsletter subscriptions (admin only)
|
|
2314
|
-
*/
|
|
2315
|
-
async importSubscriptions(siteName, data) {
|
|
2316
|
-
return this.create(
|
|
2317
|
-
this.newsletterEndpoint(siteName, "/newsletter/import"),
|
|
2318
|
-
data
|
|
2319
|
-
);
|
|
2320
|
-
}
|
|
2321
|
-
/**
|
|
2322
|
-
* Send test newsletter (admin only)
|
|
2323
|
-
*/
|
|
2324
|
-
async sendTestNewsletter(siteName, data) {
|
|
2325
|
-
return this.create(
|
|
2326
|
-
this.newsletterEndpoint(siteName, "/newsletter/test"),
|
|
2327
|
-
data
|
|
2328
|
-
);
|
|
2329
|
-
}
|
|
2330
2225
|
// ============================================
|
|
2331
2226
|
// Tracking methods (for first-party tracking)
|
|
2332
2227
|
// ============================================
|
|
@@ -2510,6 +2405,181 @@ var NewsletterClient = class extends BaseClient {
|
|
|
2510
2405
|
}
|
|
2511
2406
|
};
|
|
2512
2407
|
|
|
2408
|
+
// src/client/newsletter-management-client.ts
|
|
2409
|
+
var NewsletterManagementClient = class extends BaseClient {
|
|
2410
|
+
constructor(http, cache) {
|
|
2411
|
+
super(http, "/api/v1", cache);
|
|
2412
|
+
}
|
|
2413
|
+
managementEndpoint(siteName, endpoint) {
|
|
2414
|
+
return this.siteScopedEndpoint(
|
|
2415
|
+
siteName,
|
|
2416
|
+
`/newsletter/management${endpoint}`,
|
|
2417
|
+
{ includeSitesSegment: false }
|
|
2418
|
+
);
|
|
2419
|
+
}
|
|
2420
|
+
async listSubscriptions(siteName, params) {
|
|
2421
|
+
return this.http.get(
|
|
2422
|
+
this.buildPath(this.managementEndpoint(siteName, "/subscriptions")),
|
|
2423
|
+
params
|
|
2424
|
+
);
|
|
2425
|
+
}
|
|
2426
|
+
async getSubscriptionById(siteName, subscriptionId) {
|
|
2427
|
+
return this.getSingle(
|
|
2428
|
+
this.managementEndpoint(
|
|
2429
|
+
siteName,
|
|
2430
|
+
`/subscriptions/${encodeURIComponent(subscriptionId)}`
|
|
2431
|
+
)
|
|
2432
|
+
);
|
|
2433
|
+
}
|
|
2434
|
+
async getSubscriptionByEmail(siteName, email) {
|
|
2435
|
+
return this.http.get(
|
|
2436
|
+
this.buildPath(this.managementEndpoint(siteName, "/subscriptions/by-email")),
|
|
2437
|
+
{ email }
|
|
2438
|
+
);
|
|
2439
|
+
}
|
|
2440
|
+
async syncSubscription(siteName, data) {
|
|
2441
|
+
return this.create(this.managementEndpoint(siteName, "/subscriptions/sync"), data);
|
|
2442
|
+
}
|
|
2443
|
+
async updateSubscription(siteName, subscriptionId, data) {
|
|
2444
|
+
return this.patch(
|
|
2445
|
+
this.managementEndpoint(
|
|
2446
|
+
siteName,
|
|
2447
|
+
`/subscriptions/${encodeURIComponent(subscriptionId)}`
|
|
2448
|
+
),
|
|
2449
|
+
data
|
|
2450
|
+
);
|
|
2451
|
+
}
|
|
2452
|
+
async deleteSubscription(siteName, subscriptionId) {
|
|
2453
|
+
return this.delete(
|
|
2454
|
+
this.managementEndpoint(
|
|
2455
|
+
siteName,
|
|
2456
|
+
`/subscriptions/${encodeURIComponent(subscriptionId)}`
|
|
2457
|
+
)
|
|
2458
|
+
);
|
|
2459
|
+
}
|
|
2460
|
+
async bulkUpdateSubscriptions(siteName, data) {
|
|
2461
|
+
return this.create(this.managementEndpoint(siteName, "/subscriptions/bulk"), data);
|
|
2462
|
+
}
|
|
2463
|
+
async updateSubscriptionListMembership(siteName, subscriptionId, data) {
|
|
2464
|
+
return this.create(
|
|
2465
|
+
this.managementEndpoint(
|
|
2466
|
+
siteName,
|
|
2467
|
+
`/subscriptions/${encodeURIComponent(subscriptionId)}/list-membership`
|
|
2468
|
+
),
|
|
2469
|
+
data
|
|
2470
|
+
);
|
|
2471
|
+
}
|
|
2472
|
+
async importSubscriptions(siteName, data) {
|
|
2473
|
+
return this.create(
|
|
2474
|
+
this.managementEndpoint(siteName, "/subscriptions/import"),
|
|
2475
|
+
data
|
|
2476
|
+
);
|
|
2477
|
+
}
|
|
2478
|
+
async listLists(siteName, params) {
|
|
2479
|
+
return this.http.get(
|
|
2480
|
+
this.buildPath(this.managementEndpoint(siteName, "/lists")),
|
|
2481
|
+
params
|
|
2482
|
+
);
|
|
2483
|
+
}
|
|
2484
|
+
async getListById(siteName, listId) {
|
|
2485
|
+
return this.getSingle(
|
|
2486
|
+
this.managementEndpoint(siteName, `/lists/${encodeURIComponent(listId)}`)
|
|
2487
|
+
);
|
|
2488
|
+
}
|
|
2489
|
+
async createList(siteName, data) {
|
|
2490
|
+
return this.create(this.managementEndpoint(siteName, "/lists"), data);
|
|
2491
|
+
}
|
|
2492
|
+
async updateList(siteName, listId, data) {
|
|
2493
|
+
return this.update(
|
|
2494
|
+
this.managementEndpoint(siteName, `/lists/${encodeURIComponent(listId)}`),
|
|
2495
|
+
data
|
|
2496
|
+
);
|
|
2497
|
+
}
|
|
2498
|
+
async deleteList(siteName, listId) {
|
|
2499
|
+
return this.delete(
|
|
2500
|
+
this.managementEndpoint(siteName, `/lists/${encodeURIComponent(listId)}`)
|
|
2501
|
+
);
|
|
2502
|
+
}
|
|
2503
|
+
async listSeries(siteName, params) {
|
|
2504
|
+
return this.http.get(
|
|
2505
|
+
this.buildPath(this.managementEndpoint(siteName, "/series")),
|
|
2506
|
+
params
|
|
2507
|
+
);
|
|
2508
|
+
}
|
|
2509
|
+
async getSeriesById(siteName, seriesId) {
|
|
2510
|
+
return this.getSingle(
|
|
2511
|
+
this.managementEndpoint(siteName, `/series/${encodeURIComponent(seriesId)}`)
|
|
2512
|
+
);
|
|
2513
|
+
}
|
|
2514
|
+
async createSeries(siteName, data) {
|
|
2515
|
+
return this.create(this.managementEndpoint(siteName, "/series"), data);
|
|
2516
|
+
}
|
|
2517
|
+
async updateSeries(siteName, seriesId, data) {
|
|
2518
|
+
return this.update(
|
|
2519
|
+
this.managementEndpoint(siteName, `/series/${encodeURIComponent(seriesId)}`),
|
|
2520
|
+
data
|
|
2521
|
+
);
|
|
2522
|
+
}
|
|
2523
|
+
async deleteSeries(siteName, seriesId) {
|
|
2524
|
+
return this.delete(
|
|
2525
|
+
this.managementEndpoint(siteName, `/series/${encodeURIComponent(seriesId)}`)
|
|
2526
|
+
);
|
|
2527
|
+
}
|
|
2528
|
+
async listCampaigns(siteName, params) {
|
|
2529
|
+
return this.http.get(
|
|
2530
|
+
this.buildPath(this.managementEndpoint(siteName, "/campaigns")),
|
|
2531
|
+
params
|
|
2532
|
+
);
|
|
2533
|
+
}
|
|
2534
|
+
async getCampaignById(siteName, campaignId) {
|
|
2535
|
+
return this.getSingle(
|
|
2536
|
+
this.managementEndpoint(siteName, `/campaigns/${encodeURIComponent(campaignId)}`)
|
|
2537
|
+
);
|
|
2538
|
+
}
|
|
2539
|
+
async createCampaign(siteName, data) {
|
|
2540
|
+
return this.create(this.managementEndpoint(siteName, "/campaigns"), data);
|
|
2541
|
+
}
|
|
2542
|
+
async updateCampaign(siteName, campaignId, data) {
|
|
2543
|
+
return this.update(
|
|
2544
|
+
this.managementEndpoint(siteName, `/campaigns/${encodeURIComponent(campaignId)}`),
|
|
2545
|
+
data
|
|
2546
|
+
);
|
|
2547
|
+
}
|
|
2548
|
+
async deleteCampaign(siteName, campaignId) {
|
|
2549
|
+
return this.delete(
|
|
2550
|
+
this.managementEndpoint(siteName, `/campaigns/${encodeURIComponent(campaignId)}`)
|
|
2551
|
+
);
|
|
2552
|
+
}
|
|
2553
|
+
async sendCampaignTest(siteName, campaignId, data) {
|
|
2554
|
+
return this.create(
|
|
2555
|
+
this.managementEndpoint(
|
|
2556
|
+
siteName,
|
|
2557
|
+
`/campaigns/${encodeURIComponent(campaignId)}/test-send`
|
|
2558
|
+
),
|
|
2559
|
+
data
|
|
2560
|
+
);
|
|
2561
|
+
}
|
|
2562
|
+
async getStats(siteName, params) {
|
|
2563
|
+
return this.http.get(
|
|
2564
|
+
this.buildPath(this.managementEndpoint(siteName, "/stats")),
|
|
2565
|
+
params
|
|
2566
|
+
);
|
|
2567
|
+
}
|
|
2568
|
+
async createExport(siteName, data) {
|
|
2569
|
+
return this.create(
|
|
2570
|
+
this.managementEndpoint(siteName, "/exports"),
|
|
2571
|
+
data
|
|
2572
|
+
);
|
|
2573
|
+
}
|
|
2574
|
+
async downloadExport(siteName, exportId) {
|
|
2575
|
+
return this.http.get(
|
|
2576
|
+
this.buildPath(
|
|
2577
|
+
this.managementEndpoint(siteName, `/exports/${encodeURIComponent(exportId)}/download`)
|
|
2578
|
+
)
|
|
2579
|
+
);
|
|
2580
|
+
}
|
|
2581
|
+
};
|
|
2582
|
+
|
|
2513
2583
|
// src/client/site-users-client.ts
|
|
2514
2584
|
var SiteUsersClient = class extends BaseClient {
|
|
2515
2585
|
constructor(http, cache) {
|
|
@@ -3161,6 +3231,7 @@ var PerspectApiClient = class {
|
|
|
3161
3231
|
checkout;
|
|
3162
3232
|
contact;
|
|
3163
3233
|
newsletter;
|
|
3234
|
+
newsletterManagement;
|
|
3164
3235
|
siteUsers;
|
|
3165
3236
|
bundles;
|
|
3166
3237
|
constructor(config) {
|
|
@@ -3180,6 +3251,7 @@ var PerspectApiClient = class {
|
|
|
3180
3251
|
this.checkout = new CheckoutClient(this.http, this.cache);
|
|
3181
3252
|
this.contact = new ContactClient(this.http, this.cache);
|
|
3182
3253
|
this.newsletter = new NewsletterClient(this.http, this.cache);
|
|
3254
|
+
this.newsletterManagement = new NewsletterManagementClient(this.http, this.cache);
|
|
3183
3255
|
this.siteUsers = new SiteUsersClient(this.http, this.cache);
|
|
3184
3256
|
this.bundles = new BundlesClient(this.http, this.cache);
|
|
3185
3257
|
}
|
|
@@ -3868,6 +3940,7 @@ async function createCheckoutSession(options) {
|
|
|
3868
3940
|
HttpClient,
|
|
3869
3941
|
InMemoryCacheAdapter,
|
|
3870
3942
|
NewsletterClient,
|
|
3943
|
+
NewsletterManagementClient,
|
|
3871
3944
|
NoopCacheAdapter,
|
|
3872
3945
|
OrganizationsClient,
|
|
3873
3946
|
PerspectApiClient,
|
package/dist/index.mjs
CHANGED
|
@@ -2158,112 +2158,6 @@ var NewsletterClient = class extends BaseClient {
|
|
|
2158
2158
|
{ email }
|
|
2159
2159
|
);
|
|
2160
2160
|
}
|
|
2161
|
-
// Admin methods (require authentication)
|
|
2162
|
-
/**
|
|
2163
|
-
* Get all newsletter subscriptions (admin only)
|
|
2164
|
-
*/
|
|
2165
|
-
async getSubscriptions(siteName, params) {
|
|
2166
|
-
return this.getPaginated(
|
|
2167
|
-
this.newsletterEndpoint(siteName, "/newsletter/subscriptions"),
|
|
2168
|
-
params
|
|
2169
|
-
);
|
|
2170
|
-
}
|
|
2171
|
-
/**
|
|
2172
|
-
* Get subscription by ID (admin only)
|
|
2173
|
-
*/
|
|
2174
|
-
async getSubscriptionById(siteName, id) {
|
|
2175
|
-
return this.getSingle(
|
|
2176
|
-
this.newsletterEndpoint(siteName, `/newsletter/subscriptions/${encodeURIComponent(id)}`)
|
|
2177
|
-
);
|
|
2178
|
-
}
|
|
2179
|
-
/**
|
|
2180
|
-
* Update subscription status (admin only)
|
|
2181
|
-
*/
|
|
2182
|
-
async updateSubscriptionStatus(siteName, id, status, notes) {
|
|
2183
|
-
return this.patch(
|
|
2184
|
-
this.newsletterEndpoint(siteName, `/newsletter/subscriptions/${encodeURIComponent(id)}`),
|
|
2185
|
-
{ status, notes }
|
|
2186
|
-
);
|
|
2187
|
-
}
|
|
2188
|
-
/**
|
|
2189
|
-
* Delete subscription (admin only)
|
|
2190
|
-
*/
|
|
2191
|
-
async deleteSubscription(siteName, id) {
|
|
2192
|
-
return this.delete(
|
|
2193
|
-
this.newsletterEndpoint(siteName, `/newsletter/subscriptions/${encodeURIComponent(id)}`)
|
|
2194
|
-
);
|
|
2195
|
-
}
|
|
2196
|
-
/**
|
|
2197
|
-
* Bulk update subscriptions (admin only)
|
|
2198
|
-
*/
|
|
2199
|
-
async bulkUpdateSubscriptions(siteName, data) {
|
|
2200
|
-
return this.create(
|
|
2201
|
-
this.newsletterEndpoint(siteName, "/newsletter/subscriptions/bulk-update"),
|
|
2202
|
-
data
|
|
2203
|
-
);
|
|
2204
|
-
}
|
|
2205
|
-
/**
|
|
2206
|
-
* Create newsletter list (admin only)
|
|
2207
|
-
*/
|
|
2208
|
-
async createList(siteName, data) {
|
|
2209
|
-
return this.create(
|
|
2210
|
-
this.newsletterEndpoint(siteName, "/newsletter/lists"),
|
|
2211
|
-
data
|
|
2212
|
-
);
|
|
2213
|
-
}
|
|
2214
|
-
/**
|
|
2215
|
-
* Update newsletter list (admin only)
|
|
2216
|
-
*/
|
|
2217
|
-
async updateList(siteName, listId, data) {
|
|
2218
|
-
return this.update(
|
|
2219
|
-
this.newsletterEndpoint(siteName, `/newsletter/lists/${encodeURIComponent(listId)}`),
|
|
2220
|
-
data
|
|
2221
|
-
);
|
|
2222
|
-
}
|
|
2223
|
-
/**
|
|
2224
|
-
* Delete newsletter list (admin only)
|
|
2225
|
-
*/
|
|
2226
|
-
async deleteList(siteName, listId) {
|
|
2227
|
-
return this.delete(
|
|
2228
|
-
this.newsletterEndpoint(siteName, `/newsletter/lists/${encodeURIComponent(listId)}`)
|
|
2229
|
-
);
|
|
2230
|
-
}
|
|
2231
|
-
/**
|
|
2232
|
-
* Get newsletter statistics (admin only)
|
|
2233
|
-
*/
|
|
2234
|
-
async getStatistics(siteName, params) {
|
|
2235
|
-
return this.http.get(
|
|
2236
|
-
this.buildPath(this.newsletterEndpoint(siteName, "/newsletter/statistics")),
|
|
2237
|
-
params
|
|
2238
|
-
);
|
|
2239
|
-
}
|
|
2240
|
-
/**
|
|
2241
|
-
* Export newsletter subscriptions (admin only)
|
|
2242
|
-
*/
|
|
2243
|
-
async exportSubscriptions(siteName, params) {
|
|
2244
|
-
return this.create(
|
|
2245
|
-
this.newsletterEndpoint(siteName, "/newsletter/export"),
|
|
2246
|
-
params || {}
|
|
2247
|
-
);
|
|
2248
|
-
}
|
|
2249
|
-
/**
|
|
2250
|
-
* Import newsletter subscriptions (admin only)
|
|
2251
|
-
*/
|
|
2252
|
-
async importSubscriptions(siteName, data) {
|
|
2253
|
-
return this.create(
|
|
2254
|
-
this.newsletterEndpoint(siteName, "/newsletter/import"),
|
|
2255
|
-
data
|
|
2256
|
-
);
|
|
2257
|
-
}
|
|
2258
|
-
/**
|
|
2259
|
-
* Send test newsletter (admin only)
|
|
2260
|
-
*/
|
|
2261
|
-
async sendTestNewsletter(siteName, data) {
|
|
2262
|
-
return this.create(
|
|
2263
|
-
this.newsletterEndpoint(siteName, "/newsletter/test"),
|
|
2264
|
-
data
|
|
2265
|
-
);
|
|
2266
|
-
}
|
|
2267
2161
|
// ============================================
|
|
2268
2162
|
// Tracking methods (for first-party tracking)
|
|
2269
2163
|
// ============================================
|
|
@@ -2447,6 +2341,181 @@ var NewsletterClient = class extends BaseClient {
|
|
|
2447
2341
|
}
|
|
2448
2342
|
};
|
|
2449
2343
|
|
|
2344
|
+
// src/client/newsletter-management-client.ts
|
|
2345
|
+
var NewsletterManagementClient = class extends BaseClient {
|
|
2346
|
+
constructor(http, cache) {
|
|
2347
|
+
super(http, "/api/v1", cache);
|
|
2348
|
+
}
|
|
2349
|
+
managementEndpoint(siteName, endpoint) {
|
|
2350
|
+
return this.siteScopedEndpoint(
|
|
2351
|
+
siteName,
|
|
2352
|
+
`/newsletter/management${endpoint}`,
|
|
2353
|
+
{ includeSitesSegment: false }
|
|
2354
|
+
);
|
|
2355
|
+
}
|
|
2356
|
+
async listSubscriptions(siteName, params) {
|
|
2357
|
+
return this.http.get(
|
|
2358
|
+
this.buildPath(this.managementEndpoint(siteName, "/subscriptions")),
|
|
2359
|
+
params
|
|
2360
|
+
);
|
|
2361
|
+
}
|
|
2362
|
+
async getSubscriptionById(siteName, subscriptionId) {
|
|
2363
|
+
return this.getSingle(
|
|
2364
|
+
this.managementEndpoint(
|
|
2365
|
+
siteName,
|
|
2366
|
+
`/subscriptions/${encodeURIComponent(subscriptionId)}`
|
|
2367
|
+
)
|
|
2368
|
+
);
|
|
2369
|
+
}
|
|
2370
|
+
async getSubscriptionByEmail(siteName, email) {
|
|
2371
|
+
return this.http.get(
|
|
2372
|
+
this.buildPath(this.managementEndpoint(siteName, "/subscriptions/by-email")),
|
|
2373
|
+
{ email }
|
|
2374
|
+
);
|
|
2375
|
+
}
|
|
2376
|
+
async syncSubscription(siteName, data) {
|
|
2377
|
+
return this.create(this.managementEndpoint(siteName, "/subscriptions/sync"), data);
|
|
2378
|
+
}
|
|
2379
|
+
async updateSubscription(siteName, subscriptionId, data) {
|
|
2380
|
+
return this.patch(
|
|
2381
|
+
this.managementEndpoint(
|
|
2382
|
+
siteName,
|
|
2383
|
+
`/subscriptions/${encodeURIComponent(subscriptionId)}`
|
|
2384
|
+
),
|
|
2385
|
+
data
|
|
2386
|
+
);
|
|
2387
|
+
}
|
|
2388
|
+
async deleteSubscription(siteName, subscriptionId) {
|
|
2389
|
+
return this.delete(
|
|
2390
|
+
this.managementEndpoint(
|
|
2391
|
+
siteName,
|
|
2392
|
+
`/subscriptions/${encodeURIComponent(subscriptionId)}`
|
|
2393
|
+
)
|
|
2394
|
+
);
|
|
2395
|
+
}
|
|
2396
|
+
async bulkUpdateSubscriptions(siteName, data) {
|
|
2397
|
+
return this.create(this.managementEndpoint(siteName, "/subscriptions/bulk"), data);
|
|
2398
|
+
}
|
|
2399
|
+
async updateSubscriptionListMembership(siteName, subscriptionId, data) {
|
|
2400
|
+
return this.create(
|
|
2401
|
+
this.managementEndpoint(
|
|
2402
|
+
siteName,
|
|
2403
|
+
`/subscriptions/${encodeURIComponent(subscriptionId)}/list-membership`
|
|
2404
|
+
),
|
|
2405
|
+
data
|
|
2406
|
+
);
|
|
2407
|
+
}
|
|
2408
|
+
async importSubscriptions(siteName, data) {
|
|
2409
|
+
return this.create(
|
|
2410
|
+
this.managementEndpoint(siteName, "/subscriptions/import"),
|
|
2411
|
+
data
|
|
2412
|
+
);
|
|
2413
|
+
}
|
|
2414
|
+
async listLists(siteName, params) {
|
|
2415
|
+
return this.http.get(
|
|
2416
|
+
this.buildPath(this.managementEndpoint(siteName, "/lists")),
|
|
2417
|
+
params
|
|
2418
|
+
);
|
|
2419
|
+
}
|
|
2420
|
+
async getListById(siteName, listId) {
|
|
2421
|
+
return this.getSingle(
|
|
2422
|
+
this.managementEndpoint(siteName, `/lists/${encodeURIComponent(listId)}`)
|
|
2423
|
+
);
|
|
2424
|
+
}
|
|
2425
|
+
async createList(siteName, data) {
|
|
2426
|
+
return this.create(this.managementEndpoint(siteName, "/lists"), data);
|
|
2427
|
+
}
|
|
2428
|
+
async updateList(siteName, listId, data) {
|
|
2429
|
+
return this.update(
|
|
2430
|
+
this.managementEndpoint(siteName, `/lists/${encodeURIComponent(listId)}`),
|
|
2431
|
+
data
|
|
2432
|
+
);
|
|
2433
|
+
}
|
|
2434
|
+
async deleteList(siteName, listId) {
|
|
2435
|
+
return this.delete(
|
|
2436
|
+
this.managementEndpoint(siteName, `/lists/${encodeURIComponent(listId)}`)
|
|
2437
|
+
);
|
|
2438
|
+
}
|
|
2439
|
+
async listSeries(siteName, params) {
|
|
2440
|
+
return this.http.get(
|
|
2441
|
+
this.buildPath(this.managementEndpoint(siteName, "/series")),
|
|
2442
|
+
params
|
|
2443
|
+
);
|
|
2444
|
+
}
|
|
2445
|
+
async getSeriesById(siteName, seriesId) {
|
|
2446
|
+
return this.getSingle(
|
|
2447
|
+
this.managementEndpoint(siteName, `/series/${encodeURIComponent(seriesId)}`)
|
|
2448
|
+
);
|
|
2449
|
+
}
|
|
2450
|
+
async createSeries(siteName, data) {
|
|
2451
|
+
return this.create(this.managementEndpoint(siteName, "/series"), data);
|
|
2452
|
+
}
|
|
2453
|
+
async updateSeries(siteName, seriesId, data) {
|
|
2454
|
+
return this.update(
|
|
2455
|
+
this.managementEndpoint(siteName, `/series/${encodeURIComponent(seriesId)}`),
|
|
2456
|
+
data
|
|
2457
|
+
);
|
|
2458
|
+
}
|
|
2459
|
+
async deleteSeries(siteName, seriesId) {
|
|
2460
|
+
return this.delete(
|
|
2461
|
+
this.managementEndpoint(siteName, `/series/${encodeURIComponent(seriesId)}`)
|
|
2462
|
+
);
|
|
2463
|
+
}
|
|
2464
|
+
async listCampaigns(siteName, params) {
|
|
2465
|
+
return this.http.get(
|
|
2466
|
+
this.buildPath(this.managementEndpoint(siteName, "/campaigns")),
|
|
2467
|
+
params
|
|
2468
|
+
);
|
|
2469
|
+
}
|
|
2470
|
+
async getCampaignById(siteName, campaignId) {
|
|
2471
|
+
return this.getSingle(
|
|
2472
|
+
this.managementEndpoint(siteName, `/campaigns/${encodeURIComponent(campaignId)}`)
|
|
2473
|
+
);
|
|
2474
|
+
}
|
|
2475
|
+
async createCampaign(siteName, data) {
|
|
2476
|
+
return this.create(this.managementEndpoint(siteName, "/campaigns"), data);
|
|
2477
|
+
}
|
|
2478
|
+
async updateCampaign(siteName, campaignId, data) {
|
|
2479
|
+
return this.update(
|
|
2480
|
+
this.managementEndpoint(siteName, `/campaigns/${encodeURIComponent(campaignId)}`),
|
|
2481
|
+
data
|
|
2482
|
+
);
|
|
2483
|
+
}
|
|
2484
|
+
async deleteCampaign(siteName, campaignId) {
|
|
2485
|
+
return this.delete(
|
|
2486
|
+
this.managementEndpoint(siteName, `/campaigns/${encodeURIComponent(campaignId)}`)
|
|
2487
|
+
);
|
|
2488
|
+
}
|
|
2489
|
+
async sendCampaignTest(siteName, campaignId, data) {
|
|
2490
|
+
return this.create(
|
|
2491
|
+
this.managementEndpoint(
|
|
2492
|
+
siteName,
|
|
2493
|
+
`/campaigns/${encodeURIComponent(campaignId)}/test-send`
|
|
2494
|
+
),
|
|
2495
|
+
data
|
|
2496
|
+
);
|
|
2497
|
+
}
|
|
2498
|
+
async getStats(siteName, params) {
|
|
2499
|
+
return this.http.get(
|
|
2500
|
+
this.buildPath(this.managementEndpoint(siteName, "/stats")),
|
|
2501
|
+
params
|
|
2502
|
+
);
|
|
2503
|
+
}
|
|
2504
|
+
async createExport(siteName, data) {
|
|
2505
|
+
return this.create(
|
|
2506
|
+
this.managementEndpoint(siteName, "/exports"),
|
|
2507
|
+
data
|
|
2508
|
+
);
|
|
2509
|
+
}
|
|
2510
|
+
async downloadExport(siteName, exportId) {
|
|
2511
|
+
return this.http.get(
|
|
2512
|
+
this.buildPath(
|
|
2513
|
+
this.managementEndpoint(siteName, `/exports/${encodeURIComponent(exportId)}/download`)
|
|
2514
|
+
)
|
|
2515
|
+
);
|
|
2516
|
+
}
|
|
2517
|
+
};
|
|
2518
|
+
|
|
2450
2519
|
// src/client/site-users-client.ts
|
|
2451
2520
|
var SiteUsersClient = class extends BaseClient {
|
|
2452
2521
|
constructor(http, cache) {
|
|
@@ -3098,6 +3167,7 @@ var PerspectApiClient = class {
|
|
|
3098
3167
|
checkout;
|
|
3099
3168
|
contact;
|
|
3100
3169
|
newsletter;
|
|
3170
|
+
newsletterManagement;
|
|
3101
3171
|
siteUsers;
|
|
3102
3172
|
bundles;
|
|
3103
3173
|
constructor(config) {
|
|
@@ -3117,6 +3187,7 @@ var PerspectApiClient = class {
|
|
|
3117
3187
|
this.checkout = new CheckoutClient(this.http, this.cache);
|
|
3118
3188
|
this.contact = new ContactClient(this.http, this.cache);
|
|
3119
3189
|
this.newsletter = new NewsletterClient(this.http, this.cache);
|
|
3190
|
+
this.newsletterManagement = new NewsletterManagementClient(this.http, this.cache);
|
|
3120
3191
|
this.siteUsers = new SiteUsersClient(this.http, this.cache);
|
|
3121
3192
|
this.bundles = new BundlesClient(this.http, this.cache);
|
|
3122
3193
|
}
|
|
@@ -3804,6 +3875,7 @@ export {
|
|
|
3804
3875
|
HttpClient,
|
|
3805
3876
|
InMemoryCacheAdapter,
|
|
3806
3877
|
NewsletterClient,
|
|
3878
|
+
NewsletterManagementClient,
|
|
3807
3879
|
NoopCacheAdapter,
|
|
3808
3880
|
OrganizationsClient,
|
|
3809
3881
|
PerspectApiClient,
|