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/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,
@@ -1553,7 +1554,36 @@ var ProductsClient = class extends BaseClient {
1553
1554
  `/products/${productId}/skus`,
1554
1555
  { includeSitesSegment: false }
1555
1556
  );
1556
- return this.create(endpoint, data);
1557
+ const unitAmountCandidate = typeof data.unit_amount === "number" ? data.unit_amount : typeof data.price === "number" ? Math.round(data.price * 100) : void 0;
1558
+ if (typeof unitAmountCandidate !== "number" || !Number.isFinite(unitAmountCandidate)) {
1559
+ throw new Error("createProductSku requires unit_amount or price");
1560
+ }
1561
+ const unitAmount = unitAmountCandidate;
1562
+ const quantityAvailable = data.quantity_available !== void 0 ? data.quantity_available : data.stock_quantity ?? null;
1563
+ const payload = {
1564
+ sku: data.sku ?? null,
1565
+ unit_amount: unitAmount,
1566
+ currency: data.currency || "usd",
1567
+ quantity_available: quantityAvailable,
1568
+ published: data.published,
1569
+ gateway_price_id_test: data.gateway_price_id_test,
1570
+ gateway_price_id_live: data.gateway_price_id_live,
1571
+ value_ids: data.value_ids
1572
+ };
1573
+ if (Object.prototype.hasOwnProperty.call(data, "media_id")) {
1574
+ if (data.media_id === null) {
1575
+ payload.media_id = null;
1576
+ } else if (typeof data.media_id === "string") {
1577
+ const trimmed = data.media_id.trim();
1578
+ if (!trimmed) {
1579
+ throw new Error("createProductSku media_id cannot be empty");
1580
+ }
1581
+ payload.media_id = trimmed;
1582
+ } else if (data.media_id !== void 0) {
1583
+ throw new Error("createProductSku media_id must be a string or null");
1584
+ }
1585
+ }
1586
+ return this.create(endpoint, payload);
1557
1587
  }
1558
1588
  };
1559
1589
 
@@ -2192,112 +2222,6 @@ var NewsletterClient = class extends BaseClient {
2192
2222
  { email }
2193
2223
  );
2194
2224
  }
2195
- // Admin methods (require authentication)
2196
- /**
2197
- * Get all newsletter subscriptions (admin only)
2198
- */
2199
- async getSubscriptions(siteName, params) {
2200
- return this.getPaginated(
2201
- this.newsletterEndpoint(siteName, "/newsletter/subscriptions"),
2202
- params
2203
- );
2204
- }
2205
- /**
2206
- * Get subscription by ID (admin only)
2207
- */
2208
- async getSubscriptionById(siteName, id) {
2209
- return this.getSingle(
2210
- this.newsletterEndpoint(siteName, `/newsletter/subscriptions/${encodeURIComponent(id)}`)
2211
- );
2212
- }
2213
- /**
2214
- * Update subscription status (admin only)
2215
- */
2216
- async updateSubscriptionStatus(siteName, id, status, notes) {
2217
- return this.patch(
2218
- this.newsletterEndpoint(siteName, `/newsletter/subscriptions/${encodeURIComponent(id)}`),
2219
- { status, notes }
2220
- );
2221
- }
2222
- /**
2223
- * Delete subscription (admin only)
2224
- */
2225
- async deleteSubscription(siteName, id) {
2226
- return this.delete(
2227
- this.newsletterEndpoint(siteName, `/newsletter/subscriptions/${encodeURIComponent(id)}`)
2228
- );
2229
- }
2230
- /**
2231
- * Bulk update subscriptions (admin only)
2232
- */
2233
- async bulkUpdateSubscriptions(siteName, data) {
2234
- return this.create(
2235
- this.newsletterEndpoint(siteName, "/newsletter/subscriptions/bulk-update"),
2236
- data
2237
- );
2238
- }
2239
- /**
2240
- * Create newsletter list (admin only)
2241
- */
2242
- async createList(siteName, data) {
2243
- return this.create(
2244
- this.newsletterEndpoint(siteName, "/newsletter/lists"),
2245
- data
2246
- );
2247
- }
2248
- /**
2249
- * Update newsletter list (admin only)
2250
- */
2251
- async updateList(siteName, listId, data) {
2252
- return this.update(
2253
- this.newsletterEndpoint(siteName, `/newsletter/lists/${encodeURIComponent(listId)}`),
2254
- data
2255
- );
2256
- }
2257
- /**
2258
- * Delete newsletter list (admin only)
2259
- */
2260
- async deleteList(siteName, listId) {
2261
- return this.delete(
2262
- this.newsletterEndpoint(siteName, `/newsletter/lists/${encodeURIComponent(listId)}`)
2263
- );
2264
- }
2265
- /**
2266
- * Get newsletter statistics (admin only)
2267
- */
2268
- async getStatistics(siteName, params) {
2269
- return this.http.get(
2270
- this.buildPath(this.newsletterEndpoint(siteName, "/newsletter/statistics")),
2271
- params
2272
- );
2273
- }
2274
- /**
2275
- * Export newsletter subscriptions (admin only)
2276
- */
2277
- async exportSubscriptions(siteName, params) {
2278
- return this.create(
2279
- this.newsletterEndpoint(siteName, "/newsletter/export"),
2280
- params || {}
2281
- );
2282
- }
2283
- /**
2284
- * Import newsletter subscriptions (admin only)
2285
- */
2286
- async importSubscriptions(siteName, data) {
2287
- return this.create(
2288
- this.newsletterEndpoint(siteName, "/newsletter/import"),
2289
- data
2290
- );
2291
- }
2292
- /**
2293
- * Send test newsletter (admin only)
2294
- */
2295
- async sendTestNewsletter(siteName, data) {
2296
- return this.create(
2297
- this.newsletterEndpoint(siteName, "/newsletter/test"),
2298
- data
2299
- );
2300
- }
2301
2225
  // ============================================
2302
2226
  // Tracking methods (for first-party tracking)
2303
2227
  // ============================================
@@ -2481,6 +2405,181 @@ var NewsletterClient = class extends BaseClient {
2481
2405
  }
2482
2406
  };
2483
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
+
2484
2583
  // src/client/site-users-client.ts
2485
2584
  var SiteUsersClient = class extends BaseClient {
2486
2585
  constructor(http, cache) {
@@ -3132,6 +3231,7 @@ var PerspectApiClient = class {
3132
3231
  checkout;
3133
3232
  contact;
3134
3233
  newsletter;
3234
+ newsletterManagement;
3135
3235
  siteUsers;
3136
3236
  bundles;
3137
3237
  constructor(config) {
@@ -3151,6 +3251,7 @@ var PerspectApiClient = class {
3151
3251
  this.checkout = new CheckoutClient(this.http, this.cache);
3152
3252
  this.contact = new ContactClient(this.http, this.cache);
3153
3253
  this.newsletter = new NewsletterClient(this.http, this.cache);
3254
+ this.newsletterManagement = new NewsletterManagementClient(this.http, this.cache);
3154
3255
  this.siteUsers = new SiteUsersClient(this.http, this.cache);
3155
3256
  this.bundles = new BundlesClient(this.http, this.cache);
3156
3257
  }
@@ -3839,6 +3940,7 @@ async function createCheckoutSession(options) {
3839
3940
  HttpClient,
3840
3941
  InMemoryCacheAdapter,
3841
3942
  NewsletterClient,
3943
+ NewsletterManagementClient,
3842
3944
  NoopCacheAdapter,
3843
3945
  OrganizationsClient,
3844
3946
  PerspectApiClient,
package/dist/index.mjs CHANGED
@@ -1490,7 +1490,36 @@ var ProductsClient = class extends BaseClient {
1490
1490
  `/products/${productId}/skus`,
1491
1491
  { includeSitesSegment: false }
1492
1492
  );
1493
- return this.create(endpoint, data);
1493
+ const unitAmountCandidate = typeof data.unit_amount === "number" ? data.unit_amount : typeof data.price === "number" ? Math.round(data.price * 100) : void 0;
1494
+ if (typeof unitAmountCandidate !== "number" || !Number.isFinite(unitAmountCandidate)) {
1495
+ throw new Error("createProductSku requires unit_amount or price");
1496
+ }
1497
+ const unitAmount = unitAmountCandidate;
1498
+ const quantityAvailable = data.quantity_available !== void 0 ? data.quantity_available : data.stock_quantity ?? null;
1499
+ const payload = {
1500
+ sku: data.sku ?? null,
1501
+ unit_amount: unitAmount,
1502
+ currency: data.currency || "usd",
1503
+ quantity_available: quantityAvailable,
1504
+ published: data.published,
1505
+ gateway_price_id_test: data.gateway_price_id_test,
1506
+ gateway_price_id_live: data.gateway_price_id_live,
1507
+ value_ids: data.value_ids
1508
+ };
1509
+ if (Object.prototype.hasOwnProperty.call(data, "media_id")) {
1510
+ if (data.media_id === null) {
1511
+ payload.media_id = null;
1512
+ } else if (typeof data.media_id === "string") {
1513
+ const trimmed = data.media_id.trim();
1514
+ if (!trimmed) {
1515
+ throw new Error("createProductSku media_id cannot be empty");
1516
+ }
1517
+ payload.media_id = trimmed;
1518
+ } else if (data.media_id !== void 0) {
1519
+ throw new Error("createProductSku media_id must be a string or null");
1520
+ }
1521
+ }
1522
+ return this.create(endpoint, payload);
1494
1523
  }
1495
1524
  };
1496
1525
 
@@ -2129,112 +2158,6 @@ var NewsletterClient = class extends BaseClient {
2129
2158
  { email }
2130
2159
  );
2131
2160
  }
2132
- // Admin methods (require authentication)
2133
- /**
2134
- * Get all newsletter subscriptions (admin only)
2135
- */
2136
- async getSubscriptions(siteName, params) {
2137
- return this.getPaginated(
2138
- this.newsletterEndpoint(siteName, "/newsletter/subscriptions"),
2139
- params
2140
- );
2141
- }
2142
- /**
2143
- * Get subscription by ID (admin only)
2144
- */
2145
- async getSubscriptionById(siteName, id) {
2146
- return this.getSingle(
2147
- this.newsletterEndpoint(siteName, `/newsletter/subscriptions/${encodeURIComponent(id)}`)
2148
- );
2149
- }
2150
- /**
2151
- * Update subscription status (admin only)
2152
- */
2153
- async updateSubscriptionStatus(siteName, id, status, notes) {
2154
- return this.patch(
2155
- this.newsletterEndpoint(siteName, `/newsletter/subscriptions/${encodeURIComponent(id)}`),
2156
- { status, notes }
2157
- );
2158
- }
2159
- /**
2160
- * Delete subscription (admin only)
2161
- */
2162
- async deleteSubscription(siteName, id) {
2163
- return this.delete(
2164
- this.newsletterEndpoint(siteName, `/newsletter/subscriptions/${encodeURIComponent(id)}`)
2165
- );
2166
- }
2167
- /**
2168
- * Bulk update subscriptions (admin only)
2169
- */
2170
- async bulkUpdateSubscriptions(siteName, data) {
2171
- return this.create(
2172
- this.newsletterEndpoint(siteName, "/newsletter/subscriptions/bulk-update"),
2173
- data
2174
- );
2175
- }
2176
- /**
2177
- * Create newsletter list (admin only)
2178
- */
2179
- async createList(siteName, data) {
2180
- return this.create(
2181
- this.newsletterEndpoint(siteName, "/newsletter/lists"),
2182
- data
2183
- );
2184
- }
2185
- /**
2186
- * Update newsletter list (admin only)
2187
- */
2188
- async updateList(siteName, listId, data) {
2189
- return this.update(
2190
- this.newsletterEndpoint(siteName, `/newsletter/lists/${encodeURIComponent(listId)}`),
2191
- data
2192
- );
2193
- }
2194
- /**
2195
- * Delete newsletter list (admin only)
2196
- */
2197
- async deleteList(siteName, listId) {
2198
- return this.delete(
2199
- this.newsletterEndpoint(siteName, `/newsletter/lists/${encodeURIComponent(listId)}`)
2200
- );
2201
- }
2202
- /**
2203
- * Get newsletter statistics (admin only)
2204
- */
2205
- async getStatistics(siteName, params) {
2206
- return this.http.get(
2207
- this.buildPath(this.newsletterEndpoint(siteName, "/newsletter/statistics")),
2208
- params
2209
- );
2210
- }
2211
- /**
2212
- * Export newsletter subscriptions (admin only)
2213
- */
2214
- async exportSubscriptions(siteName, params) {
2215
- return this.create(
2216
- this.newsletterEndpoint(siteName, "/newsletter/export"),
2217
- params || {}
2218
- );
2219
- }
2220
- /**
2221
- * Import newsletter subscriptions (admin only)
2222
- */
2223
- async importSubscriptions(siteName, data) {
2224
- return this.create(
2225
- this.newsletterEndpoint(siteName, "/newsletter/import"),
2226
- data
2227
- );
2228
- }
2229
- /**
2230
- * Send test newsletter (admin only)
2231
- */
2232
- async sendTestNewsletter(siteName, data) {
2233
- return this.create(
2234
- this.newsletterEndpoint(siteName, "/newsletter/test"),
2235
- data
2236
- );
2237
- }
2238
2161
  // ============================================
2239
2162
  // Tracking methods (for first-party tracking)
2240
2163
  // ============================================
@@ -2418,6 +2341,181 @@ var NewsletterClient = class extends BaseClient {
2418
2341
  }
2419
2342
  };
2420
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
+
2421
2519
  // src/client/site-users-client.ts
2422
2520
  var SiteUsersClient = class extends BaseClient {
2423
2521
  constructor(http, cache) {
@@ -3069,6 +3167,7 @@ var PerspectApiClient = class {
3069
3167
  checkout;
3070
3168
  contact;
3071
3169
  newsletter;
3170
+ newsletterManagement;
3072
3171
  siteUsers;
3073
3172
  bundles;
3074
3173
  constructor(config) {
@@ -3088,6 +3187,7 @@ var PerspectApiClient = class {
3088
3187
  this.checkout = new CheckoutClient(this.http, this.cache);
3089
3188
  this.contact = new ContactClient(this.http, this.cache);
3090
3189
  this.newsletter = new NewsletterClient(this.http, this.cache);
3190
+ this.newsletterManagement = new NewsletterManagementClient(this.http, this.cache);
3091
3191
  this.siteUsers = new SiteUsersClient(this.http, this.cache);
3092
3192
  this.bundles = new BundlesClient(this.http, this.cache);
3093
3193
  }
@@ -3775,6 +3875,7 @@ export {
3775
3875
  HttpClient,
3776
3876
  InMemoryCacheAdapter,
3777
3877
  NewsletterClient,
3878
+ NewsletterManagementClient,
3778
3879
  NoopCacheAdapter,
3779
3880
  OrganizationsClient,
3780
3881
  PerspectApiClient,